#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
#pragma GCC target("sse", "avx")
using namespace std;
const int maxn = 16;
int a[maxn];
int dfs(int l, int r) {
  if (l > r) return 0;
  if (is_sorted(a + l, a + r + 1)) return (r - l + 1);
  int mid = l + r >> 1;
  return max(dfs(l, mid), dfs(mid + 1, r));
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  int n;
  cin >> n;
  for (int i = (0); i < (n); i++) cin >> a[i];
  cout << dfs(0, n - 1) << '\n';
}
