import numpy as np

N = int(input())
A = list(map(int, input().split()))
digit = np.zeros(60)
for a in A:
    binary = np.array(list(map(int, bin(a)[-1:1:-1])))
    digit[0:len(binary)] += binary
ans = 0
mod = 10**9+7
digit = digit * (N - digit) % mod
for i in range(60):
    ans += int(digit[i]) * pow(2, i, mod)
    ans %= mod
print(ans)
