#include<bits/stdc++.h>
using namespace std;
int n;
int dp[1005];
int v[1005];
int f(int id){
if(id == 0) return 1;
int &ret = dp[id];
if(ret != -1) return ret;
ret = 1;
for(int i = 0; i < id; i++){
int x = f(i);
if(v[i] <= v[id]) ret = max(ret, x+1);
}
return ret;
}
int main()
{
cin>>n;
for(int i = 0; i < n; i++) cin>>v[i];
fill(begin(dp), end(dp),-1);
dp[0] = 1;
f(n-1);
int ans = 1;
for(int i = 0; i < n; i++) ans = max(ans, dp[i]);
cout << ans << endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbjsKaW50IGRwWzEwMDVdOwppbnQgdlsxMDA1XTsKCmludCBmKGludCBpZCl7CiAgICBpZihpZCA9PSAwKSByZXR1cm4gMTsKICAgIGludCAmcmV0ID0gZHBbaWRdOwogICAgaWYocmV0ICE9IC0xKSByZXR1cm4gcmV0OwogICAgcmV0ID0gMTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBpZDsgaSsrKXsKICAgICAgICBpbnQgeCA9IGYoaSk7CiAgICAgICAgaWYodltpXSA8PSB2W2lkXSkgcmV0ID0gbWF4KHJldCwgeCsxKTsKICAgIH0KICAgIHJldHVybiByZXQ7Cn0KCmludCBtYWluKCkKewogICAgY2luPj5uOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgY2luPj52W2ldOwogICAgZmlsbChiZWdpbihkcCksIGVuZChkcCksLTEpOwogICAgZHBbMF0gPSAxOwogICAgZihuLTEpOwogICAgaW50IGFucyA9IDE7CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSBhbnMgPSBtYXgoYW5zLCBkcFtpXSk7CiAgICBjb3V0IDw8IGFucyA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0K