import numpy as np
N = int(input())
aaa = np.array(list(map(int, input().split())), dtype='int64')
MOD = 1_000_000_007
ans = 0
for j in range(1, N):
    ans += sum((aaa[:j] ^ aaa[j]) % MOD)
    ans %= MOD
print(ans)
