N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
  count_one = sum(a>>i & 1 for a in A)
  ans += (count_one * (N - count_one) * (2 ** i) ) % MOD
  
    
print(ans%MOD)