#include <bits/stdc++.h>
using namespace std;
int rekurziv(int min, int max, int* arr) {
  if (max == min) {
    return 1;
  }
  int now = arr[min];
  int cou = 1;
  for (int i = min + 1; i <= max; ++i) {
    if (now <= arr[i]) {
      ++cou;
      now = arr[i];
    } else {
      break;
    }
  }
  if (cou == max - min + 1) {
    return cou;
  }
  int bal = rekurziv(min, (max + min) / 2, arr);
  int jobb = rekurziv((max + min) / 2 + 1, max, arr);
  if (bal > jobb) {
    return bal;
  }
  return jobb;
}
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  if (n == 1) {
    cout << 1;
    return 0;
  }
  cout << rekurziv(0, n - 1, arr);
  return 0;
}
