MOD = 10 ** 9 + 7


n = int(input())
values = list(map(int, input().split()))
pops = [sum([(value >> i) & 1 for value in values]) for i in range(60)]
print(sum([(1 << i) * pops[i] * (n - pops[i]) for i in range(60)]) % MOD)
