MOD = 1000000007

n = int(input())
a = list(map(int,input().split()))

ans = 0
for k in range(60):
    cnt1 = 0
    for x in a:
        if ((x>>k)&1) == 1:
            cnt1 += 1
    ans += cnt1*(n-cnt1)*(1<<k)
print(ans%MOD)