n = int(raw_input())
l = [int(x) for x in raw_input().split()]
ret = 0
for bit in xrange(62):
  num = sum([(l[i] & (1 << bit)) > 0 for i in xrange(n)])
  ret += num * (n - num) * (1<<bit)
print ret % 1000000007
