#include <bits/stdc++.h>
using namespace std;
int n;
int A[20];
bool check_sort(int st, int dr) {
  if (st == dr)
    return 1;
  else
    for (int i = st + 1; i <= dr; i++)
      if (A[i] < A[i - 1]) return 0;
  return 1;
}
int find_sub(int st, int dr) {
  if (check_sort(st, dr))
    return dr - st + 1;
  else
    return max(find_sub(st, (st + dr) / 2), find_sub((st + dr) / 2 + 1, dr));
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  cout << find_sub(1, n);
  return 0;
}
