#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 100 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, ans = 0, h[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  int x = 1;
  for (; x <= pow(2, n); x += 2) {
    vector<int> v;
    bool b = true;
    for (int i = 0; i < n; i++) {
      if (x & (1 << i)) {
        v.push_back(h[i]);
      }
    }
    for (int i = 0; i < v.size() - 1; i++) {
      if (v[i] > v[i + 1]) b = false;
    }
    if (b) ans = max(ans, (int)v.size());
  }
  cout << ans;
}
