N = int(input()) A = list(map(int, input().split())) B = [] BIT = [] for i in range(N): bit = 1<