N = int(input()) A = list(map(int, input().split())) l, r = 0, 0 cnt = 0 while l