n = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
m = len(bin(max(A)))-2
zero = [0]*m
one = [0]*m
for a in A:
  for i in range(m):
    j = (a>>i)&1
    zero[i] += 1-j
    one[i] += j
ans = 0
d = [0]*m
d[0] = 1
for i in range(1,m):
  d[i] = (2*d[i-1])%mod
for i in range(m):
  ans = (ans+(zero[i]%mod)*(one[i]%mod)*d[i])%mod
print(ans)