n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(60):
    c0 = 0
    c1 = 0
    c1 = sum([1 for a in l if (a>>i) & 1])
    c0 = n - c1
    ans += (c1*c0)*(2**i)
print(ans%((10**9)+7))