n = int(input())
l = [int(i) for i in input().split()]
def xor(a,b):
    #a_ = bin(a)[2:]                                                                              
    #b_ = bin(b)[2:]                                                                              
    a_ = format(a,"b")
    b_ = format(b,"b")
    s = len(a_) - len(b_)
    if s < 0:
        a_ = "0"*abs(s) + a_
    else:
        b_ = "0"*abs(s) + b_
    x = ""
    for i in range(len(a_)):
        if a_[i] == b_[i]:
            x += "0"
        else:
            x += "1"
    return x

s = 0
for i in range(n-1):
    for j in range(i,n):
        s += int(xor(l[i],l[j]),2)
print(s%(10**9+7))
