import sys
input = sys.stdin.readline
import numpy as np

def main():
  N = int(input())
  A = np.array(list(map(int, input().split())))
  MOD = 10 ** 9 + 7

  ans = 0
  for i in range(60):
    count_one = sum(a>>i & 1 for a in A)
    ans += count_one * (N - count_one) * (2 ** i)

  print(ans%MOD)
  
if __name__ == '__main__':
  main()