mod = 10 ** 9 + 7


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 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")
        for i in range(65):
            num[i] += int(b[i])

    res = 0
    for i in range(65):
        if num[i] == 0:
            continue

        res = (res + (pow(2, i, mod) * p(N, num[i])) % mod) % mod

    print(res % mod)


if __name__ == "__main__":
    main()
