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

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
B = [0]*60
C = [0]*60

ans = 0
for i in range(60):
    D = [(A[j]>>i)&1 for j in range(N)]
    ans += D.count(0)*D.count(1)*2**i%MOD

print(ans%MOD)