mod = 10 ** 9 + 7
pows = [1] * 66
for i in range(65):
    pows[i + 1] = (pows[i] * (i + 1)) % mod


def read_valus():
    return map(int, input().split())


def read_list():
    return list(read_valus())


def read_lists(N):
    return [read_list() for n in range(N)]


def c(a, b):
    return pows[a] * pow(pows[a - b], mod - 2, mod) * pow(pows[b], mod - 2, mod) % mod


def p(N, a):
    return a * (N - a) % mod


def main():
    N = int(input())
    A = read_list()

    num = [0] * 65
    for a in A:
        b = format(a, "065b")[::-1]
        for i in range(65):
            num[i] += int(b[i])

    res = 0
    for i in range(65):
        res = (res + pow(2, i, mod) * p(N, num[i])) % mod

    print(res % mod)


if __name__ == "__main__":
    main()
