#include <bits/stdc++.h>
using namespace std;
int sorted(int pr[], int n) {
  int dr[n];
  int i;
  for (i = 0; i < n; ++i) dr[i] = pr[i];
  sort(dr, dr + n);
  int r = 1;
  for (i = 0; i < n; ++i)
    if (pr[i] != dr[i]) {
      r = 0;
      break;
    }
  return r;
}
int mxl(int ar[], int n) {
  if (n == 1) return 1;
  if (sorted(ar, n)) return n;
  int p = n / 2;
  int br[p], cr[p];
  for (int i = 0; i < p; ++i) br[i] = ar[i];
  int c = 0;
  for (int i = p; i < n; ++i) cr[c] = ar[i], c++;
  return max(mxl(br, p), mxl(cr, p));
}
int main() {
  int n;
  cin >> n;
  int ar[n];
  int i;
  for (i = 0; i < n; ++i) cin >> ar[i];
  cout << mxl(ar, n);
  return 0;
}
