from typing import Union


def count_above(obj: Union[list, int], n: int) -> int:
    """
    Return tally of numbers in obj, and sublists of obj, that are over n, if
    obj is a list.  Otherwise, if obj is a number over n, return 1.  Otherwise
    return 0.

    >>> count_above(17, 19)
    0
    >>> count_above(19, 17)
    1
    >>> count_above([17, 18, 19, 20], 18)
    2
    >>> count_above([17, 18, [19, 20]], 18)
    2
    """
    # num_over = 0
    # # base case:
    # if isinstance(obj, int):
    #     # we know obj is an int
    #     if obj > n:
    #         num_over += 1
    # else:
    #     # obj is a list.
    #     for item in obj:
    #         # item is either an int or another list.
    #         num_over += count_above(item, n)
    # return num_over

    # with listcomp and ternary...
    if isinstance(obj, int):
        return 1 if obj > n else 0
    return sum(count_above(item, n) for item in obj)