import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    t = 0
    ls = [0] * 70
    for v in a:
        tt = bin(v)
        for i in range(len(tt)-2):
            ls[i] += int(tt[-i-1])
    for v in a:
        tt = bin(v)
        for i in range(len(tt)-2):
            if tt[-i-1] == "1":
                t += 2 ** i * (n - ls[i])
                t %= mod
    print(t)


if __name__ == '__main__':
    solve()
