from scipy.misc import comb
import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input())
lis = list(map(int, input().split()))
ans = 0
x = comb(n, 2, exact=True)
for i in range(60):
    temp = 0
    for j in range(n):
        if format(lis[j],'060b')[i] == "1":
            temp += 1
    ans += 2**(59-i)*(x - comb(n-temp, 2, exact=True)-comb(temp, 2, exact=True))
ans %= mod
print(ans)