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