n=int(input())
a = list(map(lambda x: x[2:],map(bin,map(int,input().split()))))

p = 10**9+7
def xor(a,b):
    a,b = int(a),int(b)
    c = str(a+b)
    c = list(map(lambda x: '1' if x=="1" else '0',c))
    s = 0
    for i in range(len(c)):
        s += int(c[len(c)-1-i])*2**i % p
    return s%p
s = 0
for i in range(n-1):
    for j in range(i+1,n):
        s += xor(a[i],a[j])
        s = s%p
print(s)