from collections import Counter
n = int(input())
a = list(map(int,input().split()))
maxketa = max([len(bin(a[i])) for i in range(n)])-2
array = [[(a[j]>>i) & 1 for j in range(n)] for i in range(maxketa)]
"""
arrayは逆順に並んでることに注意
"""
mod = 10**9+7
tmparrayc = [Counter(array[i]) for i in range(maxketa)]
ans = sum([tmparrayc[i][0]*tmparrayc[i][1]*(2**i) % mod for i in range(maxketa)]) % mod
print(ans)