N=int(input())
import math
A=list(map(int,input().split()))
b=math.ceil(math.log2(max(A))) 
B=[0 for i in range(b)] #0のリスト
C=[0 for i in range(b)] #1のリスト
for i in A:
  for j in range(b):
    if ((i>>j) & 1):
      C[j]+=1
    else:
      B[j]+=1
 # print(B,C,i)
mod =10**9+7
ans=[(B[i]*C[i])*2**i % mod for i in range(b)]
print(sum(ans)%mod)