A function of one variable $y = f(x)$. However, I suspect that the function does not need to necessarily be strictly mathematical.
If $x = 1$, then $y = 0$.
If $x = 2$, then $y = 0$.
If $x = 10$, then $y = 9$.
If $x = 3$, then $y = 3$.
If $x = 20$, then $y = 18$.
If $x = 1990$, then $y = 1989$.
What function is it? (A puzzle from an old informatics textbook which I was unable to solve for years.)