n = int(input())
a = list(map(int, (input().split())))
result = 0
dic = {}
for i in range(n - 1):
    for j in range(i + 1, n):
        key1 = str(a[i]) + "," + str(a[j])
        key2 = str(a[j]) + "," + str(a[i])
        if (key1 in dic):
            result += int(dic.get(key1))
        elif (key2 in dic):
            result += int(dic.get(key2))
        else:
            temp = a[i] ^ a[j]
            result += temp
            dic[key1] = temp
            dic[key2] = temp

print(result % ((10 ** 9) + 7))
