#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<ll, ll>;
const int MAXN = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);
template <typename T>
T max_self(T& a, T b) {
  if (a < b) a = b;
  return a;
}
template <typename T>
T min_self(T& a, T b) {
  if (a > b) a = b;
  return a;
}
template <typename T>
T add(T x, T y) {
  return ((x % MOD) + (y % MOD)) % MOD;
}
template <typename T>
T mul(T x, T y) {
  return ((x % MOD) * (long long)(y % MOD)) % MOD;
}
template <typename T>
T sub(T x, T y) {
  return add(x, -y + MOD);
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int n;
void printVec(vector<int>& v) {
  for (int c : v) {
    cout << c << ' ';
  }
  cout << "\n";
}
bool isSorted(vector<int>& v) {
  if ((int)((v).size()) <= 1) return true;
  for (int i = 0; i < (int)((v).size()) - 1; ++i) {
    if (v[i] > v[i + 1]) return false;
  }
  return true;
}
int solve(vector<int> v) {
  if (isSorted(v)) return (int)((v).size());
  vector<int> a, b;
  a.resize((int)((v).size()) >> 1);
  b.resize((int)((v).size()) >> 1);
  for (int i = 0; i < (int)((a).size()); ++i) {
    a[i] = v[i + ((int)((v).size()) >> 1)];
  }
  for (int i = 0; i < (int)((b).size()); ++i) {
    b[i] = v[i];
  }
  return max(solve(a), solve(b));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  cout << solve(a) << "\n";
  return 0;
}
