import math

N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(60):
    num1 = len([1 for j in range(N) if A[j] & 2**i])
    num0 = N - num1

    ans += ((num1 * num0) * (2 ** i))

print(ans % (10 ** 9 + 7))
