import itertools

N = int(input())
A = list( map(int, input().split()) )

n_bmaxA = len( format(max(A), 'b') )

cmb = itertools.combinations(A, 2)

ans = 0
for item in cmb:

    if item[0] == item[1]:
        ans += 0
    else:
        bfirst = format(item[0], '0{}b'.format(n_bmaxA))
        blast = format(item[1], '0{}b'.format(n_bmaxA))

        cXOR = 0
        for i in range(len(bfirst)):
            if bfirst[i] != blast[i]:
                cXOR += 2**(len(bfirst)-1 -i)
        ans += cXOR


base = 1000000000 + 7
print(ans % base)
