def calc_xor(a, b):
    return a ^ b


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

ans = 0
for n in range(N-1):
    for k in range(n+1, N):
        a = num_list[n]
        b = num_list[k]
        ans += calc_xor(a, b)

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