n = int(input())
a = list(map(int, input().split()))
p = 10**9 + 7
num_a = [0]*60
str_a = []
for i in a:
  a_str = format(i, 'b').zfill(60)
  str_a.append(a_str)
  for j in range(len(a_str)):
    if a_str[-1-j] == '1':
      num_a[j] += 1
ans = 0
cnt = 0

for i, j in enumerate(num_a):
  ans =  (ans + j*(n-j)*2**i)%p

print(ans)