### BUGGY CODE ###

import numpy as np
i8 = np.int64
i4 = np.int32
MOD = 1000000007

def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    m = 60
    x = [0] * m
    for d in map(int, stdin.readline().split()):
        for i in range(m):
            if d & 1:
                x[i] += 1
            d >>= 1
    ans = 0
    for i in range(m - 1, -1, -1):
        ans = (ans * 2 + x[i] * (N - x[i])) % MOD
    print(ans)

main2()

### FIXED CODE ###

import subprocess
import gzip, base64, os
import stat

gz = b'H4sIALyY7V0C/+19f2BU1ZX/m5n8GH5lBkQbEGTAIKASZiCERKskgYE3MAlIAlIrPpLJhKROZrIzbyDgj6JJLOMYZf261nW3lm+767bu1lK3tWgtBFGC1iqoIIo/UAFniEjEChGE+Z5z732T+968F6Ht7vcfn5I753PP/XHOPffcH+/H/aHbO89sMgnKZRauF5AyjSkjdBnDN/rSLICVCIPg7zhhjJADdDbHVyaUqcI+lrUSWhmfBf5lwb8SM6VLzGWqcAzjU0ITF2YL/FWmCmuWCqpQEBzpdFjX/Ssoun/FSlWYn0VxZ646nZml62Pp+hi/EgpmQRUq8mWxfzUMr2FyKeFcxjeX48dr8WG5Hn+3LqJ066IyVXg747tdk+4GSJcjnP9lZ+ESVp6RXiaz+iuh0g7TAk11xUXTAvVTA03BaOvU1pLiqcVFhZFQ4XRSJzvjnV+1VKXHfFbnkcwGMD73X0YdeGRd8fGq4hNBq3XS1Pw7v96McdewdNgkHUF7Y9b4QWaTUCSsh6wx7jr4VwH/nnp3xt7Bd22UfuL744v3N6d2bejwXfJm9aa2+75X9vnUz6Vb8hyrnZPde71dR6/oGvnI0DmPjWnZstZz69MD6ecQVGCEDv6GWR+fkaOPTzPp408J+rg9bXnqa5wB/lq2fj53GOB/Mii304B/kYFcuQb4LQb4j7L08SaDcq8wyKfEQP+/M8BHGeQzw0CfqwzyaTHI54QB/zgD/kUG5f4fg3bJNrCfGoNynzXgH2ZQn5UG/MsM+E8a9IvxBvk8btDuzxjgzxrkf6eBfpoM9HmNQf3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(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
import numpy as np
i8 = np.int64
i4 = np.int32

def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    x = np.zeros(60, i8)
    for d in map(int, stdin.readline().split()):
        for j in range(x.shape[0]):
            if d & 1:
                x[j] += 1
            d >>= 1
    ans = 0
    for i in range(x.shape[0] - 1, -1, -1):
        ans = (ans * 2 + x[i] * (N - x[i])) % 1000000007
    print(ans)

'''