n = int(input())
a = [int(i) for i in input().split()]
count = [0 for i in range(60)]

for i in a:
  for j in range(len(bin(i))-2):
    if (2**j)&i != 0:
      count[j] += 1

print(sum([count[i]*(n-count[i])*2**i for i in range(len(count))])%1000000007)
