N = int(input())
A= list(map(int,input().split()))
MOD = 10**9+7
digN = 60
binA = [bin(A[i])[2:].zfill(digN) for i in range(N)]
cnt_digs = [0 for _ in range(digN)]
for i in range(N-1):
  for j in range(i+1,N):
    k = 0
    for a1,a2 in zip(binA[i], binA[j]):
      if a1 != a2:
        cnt_digs[k] += 1
      k += 1
ans = 0
for i, cnt_dig in enumerate(cnt_digs):
  ii = digN - i - 1
  if cnt_dig != 0:
    ans += ((2**ii)*cnt_dig)%MOD
print(ans%MOD)