N = int(input())
M = list(map(int, input().split()))
M = [bin(m)[2:] for m in M]
max_len = max([len(m) for m in M])
M = ["0"*(max_len-len(m))+m for m in M]
MOD = 10**9+7
result = 0
for i in range(1, max_len+1):
  zero = len([m[-i] for m in M if m[-i]=="0"])
  one = len(M) - zero
  #print(one, zero, i)
  result += (((one * zero) % MOD) * ((2 ** (i-1)) % MOD) % MOD)
  result %= MOD
print(result)