#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int start = 0;
  int end = n;
n1:
  bool ll = false;
  for (int i = start; i < end; i++) {
    if (i != start && a[i] < a[i - 1]) ll = true;
  }
  if (!ll) {
    cout << end - start;
    return 0;
  } else {
    int resl = 1, resl_max = 1;
    for (int i = start; i < (end - start) / 2 + start; i++) {
      if (i != start && a[i] >= a[i - 1]) {
        resl++;
      } else {
        if (resl > resl_max) resl_max = resl;
        resl = 1;
      }
      if (i == (end - start) / 2 + start - 1) {
        if (resl > resl_max) resl_max = resl;
        resl = 1;
      }
    }
    int resr = 1, resr_max = 1;
    for (int i = ((end - start) / 2 + start); i < end; i++) {
      if (i != (end - start) / 2 + start && a[i] >= a[i - 1]) {
        resr++;
      } else {
        if (resr > resr_max) resr_max = resr;
        resr = 1;
      }
      if (i == end - 1) {
        if (resr > resr_max) resr_max = resr;
        resr = 1;
      }
    }
    if (max(resr_max, resl_max) == resl_max) {
      end = (end - start) / 2 + start;
    } else {
      start = (end - start) / 2 + start;
    }
    goto n1;
  }
}
