So the output of the function has to be divisible by 7.
That means we only take into account the multiples of 7: $ 7, 14, 21, …, 7n $.
We only really have n options to choose from.
Because each of the n inputs can only map the values mentioned above, each only has n options.
Thus, there are $ n^n $ possible functions.