n = int(input())
s = [int(i) for i in input().split()]
ans = 0
#print("---")
for i in range(n-1):
    for j in range(n-1-i):
        a = s[i] ^ s[j+i+1]
        ans += a
        #print(s[i], s[j+i+1], "の和＝", a, ans)
#print("---")
print(ans%(10**9 +7))