N = int(input())
from collections import defaultdict
d = dict()
d[0] = defaultdict(int)
d[1] = defaultdict(int)
for i in map(int,input().split()):
  for idx,j in enumerate(reversed('{:b}'.format(i))):
    d[int(j)][idx]+=1

m = max(set(d[0].keys()) | set(d[1].keys()) )

print(int(sum([((2**i)* (N-d[1][i])*d[1][i])%(1e9+7) for i in range(m+1)])%(1e9+7)))
