n = int(input())
a = list(map(lambda x:format(int(x), '060b') , input().split()))
n1 = [0]*60
for i in a:
  for j in range(60):
    if i[59-j]=='1':
      n1[j] += 1
ans = 0
for i in range(60):
  ans += n1[i]*(n-n1[i])*2**i
  ans %= 10**9+7
print(ans)