N = int(input())
A = [str(bin(a)).lstrip('0b').zfill(60) for a in map(int,input().split())]
A_rev = list(zip(*A))

ans = 0
for i, a in enumerate(A_rev):
	k = a.count('1')
	ans+=(k*(N-k)*2**(59-i))
print(ans%(10**9+7))