How to calculate permutation and combination