#include <bits/stdc++.h>
using namespace std;
bool isSorted(vector<int>& vec, int idx_1, int idx_2) {
  for (int i = idx_1 + 1; i <= idx_2; i++)
    if (vec[i] < vec[i - 1]) return false;
  return true;
}
int thanosSort(vector<int>& vec, int p, int r) {
  if (p < r) {
    if (isSorted(vec, p, r)) return (r - p + 1);
    int half = (int)((p + r) / 2);
    int len_1 = thanosSort(vec, p, half);
    int len_2 = thanosSort(vec, half + 1, r);
    return max(len_1, len_2);
  }
  return 1;
}
int main() {
  vector<int> vec;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int input;
    cin >> input;
    vec.push_back(input);
  }
  int len = thanosSort(vec, 0, vec.size() - 1);
  cout << len << endl;
}
