a=int(input())
b=input().split()
sum=0
for i in range(a-1):
    for x in range(a-i-1):
        c=int(b[i])
        d=int(b[x+i+1])
        e=format(c,'b')
        f=format(d,'b')
        g=str(int(e)+int(f))
        h=[]
        for j in range(len(g)):
            if g[j]=='2':
                k='0'
                h.append(k)
            else:
                k=g[j]
                h.append(k)
        l=''.join(h)
        m=int(l,2)
        sum+=m
print(sum%(pow(10,9)+7))
