#include <bits/stdc++.h>
using namespace std;
int i, n, a[+100500];
bool Try(int x) {
  if (x > n) return 0;
  for (int j = 0; j < 100; j++)
    if (j * x < n) {
      bool p = 1;
      for (int i = j * x; i < (j + 1) * x - 1; i++)
        if (a[i] > a[i + 1]) p = 0;
      if (p) return 1;
    }
  return 0;
}
int main() {
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  vector<int> h;
  h.push_back(16);
  h.push_back(8);
  h.push_back(4);
  h.push_back(2);
  h.push_back(1);
  for (int o : h)
    if (Try(o)) {
      cout << o << endl;
      return 0;
    }
}
