n = input()
l = list(map(int,input().split()))
ans = 0
for i in range(60):
    c0 = 0
    c1 = 0
    for s in l:
        s0 = format(s,"b").zfill(60)
        s0 = s0[::-1]
        if s0[i] == "1": c1 += 1
        else: c0 += 1
    ans += (c1*c0)*(2**i)
print(ans%10**9+7)