n = int(input())
A_list = [[int(i) for i in bin(int(A))[2:].zfill(60)] for A in input().split()]
print(sum([2**(59-i) * sum([A_list[j][i] for j in range(n)]) * (n-sum([A_list[j][i] for j in range(n)])) for i in range(60)])
%(10**9+7))