#include <bits/stdc++.h>
using namespace std;
int arr[100];
int mx = 0;
int main() {
  int n, mx1 = 0, mx3 = 0, mx4 = 0, s = 0, f = 0, mx5 = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] >= s)
      s = arr[i];
    else
      f = 1;
  }
  if (!f) return cout << n, 0;
  for (int i = 0; i < n; i += 8) {
    int mx2 = 0, cnt = 0;
    if (i == n - 7) break;
    for (int j = i; j < i + 8; j++) {
      if (arr[j] >= mx2)
        mx2 = arr[j];
      else
        cnt = 1;
    }
    if (!cnt) mx1 = 8;
  }
  for (int i = 0; i < n; i += 4) {
    int mx2 = 0, cnt = 0;
    if (i == n - 3) break;
    for (int j = i; j < i + 4; j++) {
      if (arr[j] >= mx2)
        mx2 = arr[j];
      else
        cnt = 1;
    }
    if (!cnt) mx3 = 4;
  }
  for (int i = 0; i < n; i += 2) {
    int mx2 = 0, cnt = 0;
    if (i == n - 1) break;
    for (int j = i; j < i + 2; j++) {
      if (arr[j] >= mx2)
        mx2 = arr[j];
      else
        cnt = 1;
    }
    if (!cnt) mx4 = 2;
  }
  return cout << max(mx1, max(mx3, max(mx4, mx5))), 0;
  return 0;
}
