n=int(input())
a = list(map(lambda x:format(x,'b'),map(int,input().split())))
b = list(map(len,a))

p = 10**9+7
s = 0
for i in range(max(b)):
    zero = 0
    one = 0
    for j in range(n):
        if len(a[j]) < i+1:
            zero += 1
            continue
        if a[j][-(1+i)]=='1':
            one += 1
        else:
            zero += 1
    s += (one*zero)*2**i%p

print(s%p)
