//最长不下降子序列
//状态转移方程dp[i] = max(1,dp[j]+1),条件:arr[j] <= arr[i] && dp[j]+1>dp[i]
//时间复杂度O(n^2)
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int n;
scanf("%d",&n);
int arr[1000],dp[1000];
for(int i = 0;i < n;i++){
scanf("%d",&arr[i]);
}
int ans = -1;
for(int i = 0;i < n;i++){
dp[i] = 1;
for(int j = 0;j < i;j++){
if(arr[j] <= arr[i] && dp[j]+1>dp[i]){
dp[i] = dp[j]+1;
}
}
ans = max(ans,dp[i]);
}
printf("%d",ans);
}