import itertools
from operator import or_
from operator import and_


def majority(*args):
    """
    Return a CNF expression that means
    "the majority of input functions are true".
    """
    clauses = list()
    for xs in itertools.combinations(args, (len(args) + 1) // 2):
        clauses.append(or_(*xs))
    return and_(*clauses)