def xor(a,b):
    
    # aよりもbの方を長くする
    if len(b) < len(a):
        a,b = b,a
        
    # 長さを取っておく
    na = len(a)
    nb = len(b)
    
    # xor計算
    t = b[:nb-na] + "".join([ str(int(sa!=sb)) for sa,sb in zip(a,b[nb-na:]) ])
    
    return int(t,2)

n = int(input())
numbers = [bin(int(i))[2:] for i in input().split(" ")]

total = 0
for i in range(n):
    for j in range(i+1,n):
        total += xor(numbers[i],numbers[j])        
print(int(total%(1e9+7)))