Let $f$ be a function which takes in $0, 1, 2$ and returns $0, 1, $ or $2$. The values need not be distinct: for instance we could have $f(0) = 1, f(1) = 1, f(2) = 2$. How many such functions are there which satisfy \[f(2) + f(f(0)) + f(f(f(1))) = 5?\]

Let's think step by step and output the final answer within \boxed{}.
user