#include <bits/stdc++.h>
using namespace std;
const long long int INF = 2e18 + 99;
bool file = 0, rt = 1;
clock_t tStart;
void FAST_IO();
long long int find_ans(vector<int> v, long long int st, long long int n) {
  bool flag = true;
  long long int cnt = 1;
  for (int i = st; i < n; i++) {
    if (v[i] > v[i + 1]) {
      flag = false;
      break;
    }
    cnt++;
  }
  if (flag) {
    return cnt;
  } else {
    long long int mid = (st + n) / 2;
    long long int temp = max(find_ans(v, st, mid), find_ans(v, mid + 1, n));
    return temp;
  }
}
int main() {
  FAST_IO();
  long long int n;
  scanf("%lld ", &n);
  ;
  long long int cnt = 1, rem = 0;
  vector<int> v;
  v.push_back(0);
  for (int i = 0; i < n; ++i) {
    scanf("%lld ", &rem);
    ;
    v.push_back(rem);
  }
  printf("%lld\n", find_ans(v, 1, n));
  if (rt && file) {
    printf("\nTime taken: %.6fs", (double)(clock() - tStart) / CLOCKS_PER_SEC);
  }
  return 0;
}
void FAST_IO() {
  if (rt && file) {
    tStart = clock();
  }
  if (file) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
}
