import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(60):
    t = 2**i
    B = [A[j]&t for j in range(N)]
    c = B.count(0)
    ans += c*(N-c)*(t%MOD)%MOD

print(ans%MOD)