import sys
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().strip().split()]
MOD = 10 ** 9 + 7
ans = 0

for i in range(60+1):
    zero = 0
    one = 0
    for a in A:
        if a >> i & 1 == 1:
            one += 1
        else:
            zero += 1
    ans += (one * zero) * 2 ** i
    ans = ans % MOD
print(ans % MOD)