n = int(input())

ass = list(map(int,input().split()))

m = len(bin(max(a))) - 2

ans = 0
for i in range(60):
    k = 1 << i
    i_1 = sum([k & a for a in ass]) >> i
    ans += i_1 * (n - i_1) << i
    ans = ans % ((10**9) + 7)

print(ans)
