// This file is a "Hello, world!" in D language by DMD for wandbox.
import std.stdio;
import std.bigint;
import std.conv;
import std.string;
import std.algorithm;

ulong dfs(int[] arr)
{
	bool flag = true;
	int prev = -1;
	foreach (v; arr)
	{
		flag &= prev <= v;
		prev = v;
	}
	if (flag)
	{
		return arr.length;
	}
	else
	{
		return max(arr[0..$/2].dfs, arr[$/2..$].dfs);
	}
}

void main()
{
	int n = readln.chomp.to!int;
	int[] arr = readln.chomp.split.to!(int[]);
	arr.dfs.writeln;
}

// DMD reference:
//   https://dlang.org/dmd-linux.html

// D language references:
//   https://dlang.org
//   http://www.kmonos.net/alang/d/ ( Japanese p