MOD = 10 ** 9 + 7
N = int(input())
l_in = list(map(int, input().split()))
d_ans = {}
sum = 0
for i in range(N - 1):
  if i in d_ans:
    sum = (sum + d_ans[i]) % MOD
    continue
  d_ans[i] = 0
  for j in range(i, N):
    a = l_in[i] ^ l_in[j]
    d_ans[i] = (d_ans[i] + a) % MOD
    sum = (sum + a) % MOD
print(sum)