Differences of the permutations

Problem Name:
Differences of the permutations
Site:HackerEarth
Links:
Tags:
Problem setters: