def main():
  import sys
  input = sys.stdin.readline
  n = int(input())
  a = list(map(int,input().split()))
  os = [0]*60
  for ai in a:
    bi = bin(ai)[2:]
    for j in range(len(bi)):
      if bi[-j-1] == "1":
        os[j] += 1
  mod = 10**9+7
  s = 0
  k = 1
  for i in range(60):
    x = (n-os[i])*os[i]
    s = (s+x*k)%mod
    k = (2*k)%mod
  print(s)
if __name__ == '__main__':
  main()