N = int(input().strip())
arrayH = list(map(int, input().strip().split(' ')))
ans = 1
i = 0
while arrayH[i] <= arrayH[i+1]:
                ans = i + 1
                i = i + i
                if i == N - 1:
                        break
print(ans)
