If the set E has n elements, we can partition it into k chosen fixed points and n − k non-fixed points under f, and then kn−k is the number of different idempotent functions. Hence, taking into account all possible partitions,