def count_unplayed_cards(r, progress):
    """Returns the number of cards which are not yet played, including cards
    which are unplayable because all those cards (or cards of a value below it)
    are already discarded"""
    n = 0
    for suit in r.suits:
        n += 5 - progress[suit]
    return n