#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int a[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = n; i > 0; i >>= 1)
    for (int j = 0; j < n; j += i)
      if (is_sorted(a + j, a + j + i)) {
        cout << i;
        return 0;
      }
}
