#include <bits/stdc++.h>
using namespace std;
int main() {
  int A[100];
  int length;
  cin >> length;
  for (int i = 1; i <= length; i++) {
    cin >> A[i];
  }
  int ans = 0;
  if (length == 1) {
    ans = 1;
    cout << ans << endl;
    return 0;
  }
  if (length == 2) {
    if (A[1] <= A[2]) {
      ans = 2;
      cout << ans << endl;
      return 0;
    } else {
      ans = 1;
      cout << ans << endl;
      return 0;
    }
  }
  if (length == 4) {
    int sum = 0;
    for (int i = 1; i <= 3; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    if (A[1] <= A[2] || A[3] <= A[4]) {
      ans = 2;
      cout << ans << endl;
      return 0;
    } else {
      ans = 1;
      cout << ans << endl;
      return 0;
    }
  }
  if (length == 8) {
    int sum = 0;
    for (int i = 1; i <= 7; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 7) {
        ans = 8;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 1; i <= 3; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 5; i <= 7; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    if (A[1] <= A[2] || A[3] <= A[4] || A[5] <= A[6] || A[7] <= A[8]) {
      ans = 2;
      cout << ans << endl;
      return 0;
    } else {
      ans = 1;
      cout << ans << endl;
      return 0;
    }
  }
  if (length == 16) {
    int sum = 0;
    for (int i = 1; i <= 15; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 15) {
        ans = 16;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 1; i <= 7; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 7) {
        ans = 8;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 9; i <= 15; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 7) {
        ans = 8;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 1; i <= 3; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 5; i <= 7; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 9; i <= 11; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    sum = 0;
    for (int i = 13; i <= 15; i++) {
      if (A[i] <= A[i + 1]) {
        sum++;
      }
      if (sum == 3) {
        ans = 4;
        cout << ans << endl;
        return 0;
      }
    }
    if (A[1] <= A[2] || A[3] <= A[4] || A[5] <= A[6] || A[7] <= A[8] ||
        A[9] <= A[10] || A[11] <= A[12] || A[13] <= A[14] || A[15] <= A[16]) {
      ans = 2;
      cout << ans << endl;
      return 0;
    } else {
      ans = 1;
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}
