I will answer this question for the finite case only.

Being beginner, you may not understand the reply.

You need to know how to use the generalizedinclusion/exclusion rule.

Let denote the number of elements in set .

Ifthere are no ontofunctions .

If then number of onto functions is given by:

.