# -*- coding: utf-8 -*-

n=int(input())
a=list(map(int, input().split()))
s = 0
for i in range(0,n-1):
    for j in range(i+1,n):
        res = a[i] ^ a[j]
        s += res
        print(res)
print(s% (1000000000 + 7))
