N = int(input())
A = [int(x) for x in input().split()]
ans = 0
for i in range(60):
    tmp = [x >> i & 1 for x in A]
    ans += (tmp.count(True) * tmp.count(False)) * 2 ** i
    ans = ans % (10 ** 9 + 7)
print(ans)
