n = int(input())
l = list(map(int,input().split()))
lone = [0]*60
for i in range(n):
  m = l[i]
  for j in range(59,-1,-1):
    if m >= 2**j:
      m = m -2**j
      lone[j] += 1
ans = 0
const = 10**9+7
for i in range(60):
  ans += (2**i*lone[i]*(n-lone[i]))%const
print(ans%const)
