def main():
  n = int(input())
  ar = list(map(int,input().split(' ')))
  sum = 0

  for i in range(0,62):
    zero , one = 0 , 0
    for j in range(len(ar)):
      if ar[j]%2 == 1:
        one+=1
      else:
        zero+=1
      ar[j]//=2
    
    idsum =  one * zero * (1 << i)
    sum = sum + idsum
  
  print(sum%int(1e9+7))

main()  