import sys
input = sys.stdin.readline
def solve():
  n = int(input())
  a = list(int(i) for i in input().split())
  one = [0]*61
  zero = [0]*61
  for number in a:
    for i in range(61):
      if number >> i &1 == 1:
        one[i] +=1
      else:
        zero[i] += 1
  ans = 0
  mod = 10**9+7
  for i in range(61):
    ans += one[i]*zero[i]*int(2**i)%mod
    ans %= mod
  print(ans)
        
solve()