import numpy as np

N = int(input())
A = np.array(tuple(map(int,input().split())),np.int64)

ans = 0
mod = int(1e9+7)
for i in range(61):
    tmp = (A>>i)&1
    tmp = np.sum(tmp[tmp>0])
    ans += (N-tmp)*tmp*pow(2,i,mod)
print(ans%mod)