#include <iostream> using namespace std; int main() { int k; cin >> k; int nums[k]; for (int i = 0; i < k; i++) cin >> nums[i]; int dp[k]; int ans = 1; for (int i = 0; i < k; i++) { dp[i] = 1; for (int j = 0; j < i; j++) { if (nums[j] >= nums[i] && dp[j] + 1 > dp[i]) dp[i] = dp[j] + 1; } if (dp[i] > ans) ans = dp[i]; } cout << ans << endl; return 0; }