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):
    zero[i] += 1-(a>>i)&1
    one[i] += (a>>i)&1
ans = 0
for i in range(m):
  ans = (ans+zero[i]*one[i]*2**i)%mod
print(ans)