n = int(input())
arr = list(map(int, input().split(' ')))

maxi = 62
mod = int(1e9) + 7
ones = [0 for _ in range(maxi)]
for num in arr:
    x = bin(num)[2:]
    # print(x)
    for idx, val in enumerate(reversed(x)):
        ones[idx] += int(val)

ans = 0
for idx, val in enumerate(ones):
    ans += ((pow(2, idx) % mod) * (((n - val)%mod) * (val%mod))) % mod

    ans %= mod

print(ans)