#include <bits/stdc++.h>
using namespace std;
vector<int> seq;
int main() {
  int n;
  cin >> n;
  int a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    seq.push_back(a);
  }
  int dp[100001];
  dp[0] = 0;
  for (int i = 1; i <= n; ++i) {
    int lis1 = dp[i - 1];
    int lis2 = 1;
    int mx = seq[i - 1];
    for (int j = i - 2; j >= 0; --j) {
      if (seq[j] < mx) {
        mx = seq[j];
        ++lis2;
      }
    }
    dp[i] = max(lis1, lis2);
  }
  cout << dp[n] << endl;
  return 0;
}
