n = int(input())
a = [int(i) for i in input().split()]

div = 10 ** 9 + 7

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ai = bin(a[i])
        aj = bin(a[j])
        ai = ai[2:]
        aj = aj[2:]
        dif = len(ai) - len(aj)
        if dif > 0:
            add = ''
            for _ in range(dif):
                add += '0'
            aj = add + aj
        elif dif < 0:
            add = ''
            for _ in range(-dif):
                add += '0'
            ai = add + ai
        xor = ['0' for _ in range(len(ai))]
        for k in range(len(ai)):
            if ai[k] != aj[k]:
                xor[k] = '1'
        plus = '0b'
        for k in range(len(ai)):
            plus += xor[k]
        plus = int(plus, 2)
        ans += plus
        ans %= div

print(ans)
