from bisect import bisect_left, bisect_right N = int(input()) A = list(map(int, input().split())) ans = [] for i in reversed(range(30)): b = bisect_left(A, ((1<<30)-1)-((1<