import numpy as np
from operator import xor
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N = int(input())
A = np.array([int(i) for i in input().split()])
MOD = 10**9 + 7

answer = 0
for i in range(N-1):
    a = A[i+1:]
    answer += sum(xor(a,A[i]))

print(answer % MOD)