>>747292Each function f:X->X can be interpreted as a string of length 2n over an alphabet with 2n symbols, such that the i-th letter is f(i).
So the number of such functions is the same as the number of such strings where each even-position letter contains an even-numbered symbol (of which there are n to choose from), and likewise, each odd-position letter contains an odd-numbered symbol (again, there are n odd-numbered symbols to choose from).
So there are n possible symbols for each of the 2n positions, and since the 2n choices are independent of each other, the total number of such strings (i.e. functions) is n^(2n).