import math
N = int(input())
li = list(map(int,input().split()))	
big = math.floor(math.log2(max(li))) + 1
ans = 0
for i in range(big):
    one = sum([1 if (l >> i) & 1 else 0 for l in li])
    t = (2**i) % (10**9+7)
    ans += t * one * (N-one)
print(ans % (10**9+7))