import numpy as np
n = int(input())
a = list(map(int, input().split()))
p = 7 + 10**9

b = [tuple(map(int, format(i, "060b"))) for i in a]
bits1 = np.array(b)
bits0 = bits1 ^ 1

accum1 = np.add.accumulate(bits1)
accum0 = np.add.accumulate(bits0)

sum1 = bits1[-1:0:-1] * accum0[-2::-1]
sum0 = bits0[-1:0:-1] * accum1[-2::-1]

s1 = np.sum(sum1, axis=0)
s0 = np.sum(sum0, axis=0)

ans = (s1 + s0) * (2 ** np.array(tuple(range(59,-1,-1)), np.int64)) % p

print(np.sum(ans) % p)