def main():
    import sys

    input = sys.stdin.readline

    mod = 10 ** 9 + 7

    n = int(input())
    a = tuple(map(int, input().split()))

    ret = 0
    for j in range(60):
        cnt1 = sum((x >> j) & 1 for x in a)
        cnt0 = n - cnt1
        ret = (ret + cnt0 * cnt1 * (1 << j)) % mod

    print(ret)


if __name__ == '__main__':
    main()
