#include <bits/stdc++.h>
using namespace std;
int inf = 1000 * 1000 * 1000;
int64_t inf64 = inf * inf;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 1;
  for (int i = 0; i < n; ++i) cin >> v[i];
  for (int i = 2; i <= n; i *= 2) {
    for (int j = 0; j < n; j += i) {
      vector<int> a, a1;
      for (int t = j; t < j + i; ++t) {
        a.push_back(v[t]);
        a1.push_back(v[t]);
      }
      sort(a.begin(), a.end());
      if (a == a1) ans = max(ans, int(a.size()));
    }
  }
  cout << ans;
}
