n = int(input())
a = list(map(int, input().split()))
a_bi = []

for i in range(n):
    a_bi_e = format(a[i], 'b')
    a_bi.append(a_bi_e)

MOD = 10 ** 9 + 7
S = 0

for i in range(n-1):
    k = i + 1
    while k < n:
        string = ''
        dlen = len(a_bi[i]) - len(a_bi[k]) 
        if dlen == 0:
            for j in range(len(a_bi[i])):
                string_e = int(a_bi[i][j]) ^ int(a_bi[k][j])
                string += str(string_e)
        if dlen > 0:
            for j in range(dlen):
                string += a_bi[i][j]
            for j in range(len(a_bi[k])):
                string_e = int(a_bi[i][j+dlen]) ^ int(a_bi[k][j])
                string += str(string_e)
        if dlen < 0:
            dlen *= -1
            for j in range(dlen):
                string += a_bi[k][j]
            for j in range(len(a_bi[i])):
                string_e = int(a_bi[i][j]) ^ int(a_bi[k][j+dlen])
                string += str(string_e)
        k += 1
        S += (int(string, 2) % MOD)
S %= MOD
print(S)