import itertools

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

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


cmb = itertools.combinations(A, 2)

ans = 0
for item in cmb:

    bfirst = format(item[0], '0{}b'.format(n_bmaxA))
    blast = format(item[1], '0{}b'.format(n_bmaxA))

    cXOR = []
    for i in range(len(bfirst)):
        if bfirst[i] == blast[i]:
            cXOR.append("0")
        else:
            cXOR.append("1")

    cXOR = ''.join(cXOR)
    ans += int(cXOR, 2)


base = 1000000000 + 7
print(ans % base)