N = int(input())
A = list(map(int, input().split()))

ans = 0
for k in range(60):
    x = 0
    x0 = 0
    x1 = 0
    for a in A:
        x = format(a>>k&1,'b')
        if x == '0':
            x0 += 1
        else:
            x1 += 1

    ans += ((2**k)*x0*x1)

print(ans%(10**9+7))