binary = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 73741817, 147483634, 294967268, 589934536, 179869065, 359738130, 719476260, 438952513, 877905026, 755810045, 511620083, 23240159, 46480318, 92960636, 185921272, 371842544, 743685088, 487370169, 974740338, 949480669, 898961331, 797922655, 595845303, 191690599, 383381198, 766762396, 533524785, 67049563, 134099126, 268198252, 536396504]

n = int(input())
a = [format(i,"b") for i in map(int, input().split())]
mod = 10**9+7
b = [0 for _ in range(61)]

for i in range(n):
    for j in range(len(a[i])):
        b[j] += int(a[i][-j-1])

result = 0
for i in range(61):
    r = b[i]*(n-b[i])%mod
    r = r*binary[i]%mod
    result += r
print(result%mod)