mod = 10**9+7
n = int(input())
lis = list(map(int, input().split()))
ans = 0

for i in range(60):
    czero = 0
    cone = 0
    for j in range(n):
        if (lis[j] >> i) & 1 == 0:
            czero += 1
        else:
            cone += 1
    ans += czero * cone * 2**i
ans = ans % mod
print(ans)