check this
related theory https://math.stackexchange.com/questions/334420/number-of-onto-functions
formula derivation is in given link
@Gurdeep Saini
who just down vote but didn't participate in the discussion, doesn't get this comment as notification
@Shaik Masthan he/she should give the reason what is wrong in this answer
64.3k questions
77.9k answers
244k comments
80.0k users