import numpy as np
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
now = 1

sum = np.zeros(60,dtype=int)
for i in a:
    aa = np.array(list(map(int,list(str(format(i,'060b'))))))
    
    sum += aa

for i in range(60):
    k = (sum[59-i]*(n-sum[59-i]))%mod
    ans = (ans+(k*now)%mod)%mod
    now = (now*2)%mod

print(ans)