#include <stdio.h> int main() { int a; while (scanf("%d", &a) != EOF) { int arr[a]; for (int i=0;i<a;i++){ scanf("%d", &arr[i]); } int dp[a]; dp[a-1]=1; for (int i=a-2;i>=0;i--){ dp[i]=1; for (int j=i+1;j<a;j++){ int temp=1; if(arr[i]>=arr[j]){ temp+=dp[j]; if (temp>dp[i]){ dp[i]=temp; } } } } int max=1; for (int i=0;i<a;i++){ if(dp[i]>0&&dp[i]<=a){ if (max<dp[i]){ max = dp[i]; } } } printf("%d\n", max); } return 0; }