#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
const int MOD = 1000000007;
using namespace std;
int ifSort(int arr[], int a, int b) {
  int l = b - a + 1;
  if (l == 1) {
    return 1;
  }
  for (int i = a; i < b; i++) {
    if (!(arr[i] <= arr[i + 1])) {
      return max(ifSort(arr, a, a + l / 2 - 1), ifSort(arr, a + l / 2, b));
    }
  }
  return b - a + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int a = 0;
  int b = n - 1;
  cout << ifSort(arr, 0, n - 1) << "\n";
  return 0;
}
