N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

bit2 = [0] * 80
for i in range(N):
  bin_a = bin(A[i])
  #print(bin_a)#2なら0b10と返す
  str_bin_a = str(bin_a)[2:]
  #print(str_bin_a)
  l = len(str_bin_a)
  for j in range(l):
    bit2[j] += int(str_bin_a[-(j + 1)])
    
#print(bit2)
ans = 0
for i in range(80):
  count1 = bit2[i]
  count0 = N - count1
  ans += ((2 ** i) * count0 * count1) % MOD
  
print(ans % MOD)
  
  