#include <bits/stdc++.h>
using ll = long long;
const ll N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll SZ = 101;
const double eps = 1e-9;
using namespace std;
pair<pair<ll, ll>, ll> t[4 * N];
ll ans = 1, arr[N];
bool check(ll l, ll r) {
  for (ll i = l; i <= r; ++i) {
    if (i > l && arr[i] < arr[i - 1]) return false;
  }
  return true;
}
ll build(ll l, ll r) {
  ll mid = (l + r) / 2;
  if (check(l, r)) {
    return (r - l + 1);
  } else {
    return max(build(l, mid), build(mid + 1, r));
  }
}
void solve() {
  ll n;
  cin >> n;
  for (ll i = (1); i <= (n); i++) cin >> arr[i];
  cout << build(1, n);
}
int32_t main(int32_t argc, char *argv[]) {
  double t1 = clock();
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll TC = 1, t = 0;
  while (t++ < TC) {
    solve();
  }
  if (false)
    cerr << "Time : " << 1000 * (clock() - t1) / CLOCKS_PER_SEC << " ms\n";
  return 0;
}
