def d():
  N = int(input())
  A = list(map(int,input().split()))
  
  ans = 0
  for i in range(60):
    num_one = sum([1 for x in range(N) if A[x] & (1 << i) != 0])
    ans = (ans + (1 << i) * num_one * (N - num_one)) % 1000000007
  print(ans)
        
d()
