import math


def f(n):
    """
    Define f(n) as the sum of the digit factorials for given number n.
    For example:
        f(342) = 3! + 4! + 2! = 32
    :param n: number
    :return: sum digit factorial
    """
    return sum(math.factorial(int(ch)) for ch in str(n))