words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

ys = []
n = 0
for x in xs:
    y = list(reversed(bin(x)))[:-2]
    ys.append(y)
    n = max(n, len(y))
print(ys, n)
ans = 0
for i in range(n):
    x0 = 0
    x1 = 0
    for y in ys:
        #print(y,i,len(y))
        if i < len(y):
            if y[i] == "1":
                x1 += 1
            else:
                x0 +=1
        else:
            x0 += 1
    #print(x1,x0)
    ans += x1 * x0 * (2**(i))
    ans %= 10**9 + 7
print(ans)
