n = int(input())
a = list(map(int, input().split()))
xor_sum = 0

for i in range(n - 1):
    for j in range(i, n):
        try:
            xor_sum += a[i] ^ a[j + 1]
        except:
            pass

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