class Num:
    nums=[]
    sum=0
    def __init__(self,num):
        for val in Num.nums:
            Num.sum+=val^num
        Num.nums.append(num)
        Num.sum%=1000000007

n=input()
a=input().split()

for val in a:
    num=Num(int(val))

print(num.sum)