inf = int(1e9+7);
def sumXOR( arr,  n): 
  sum = 0
  for i in range(0, 60):  
    zc = 0
    oc = 0 
    idsum = 0
    for j in range(0, n): 
      if (arr[j] % 2 == 0): 
        zc = zc + 1
      else: 
          oc = oc + 1
      arr[j] = int(arr[j] / 2)  
    idsum = oc * zc * (1 << i)     
    sum = (sum + idsum)%inf
  return sum
def solve():
  n = int(input())
  arr = list(map(int, input().split()))
  temp = sumXOR(arr, n)
  print(temp)
solve()