#P334. 【例57.1】 字典序第几小
【例57.1】 字典序第几小
Description
From the digits starting from to (), a total of different permutations can be formed. Given one of these permutations, determine its lexicographical order among all permutations.
Input Format
The first line contains an integer .
The second line contains an integer , which is a permutation of the digits from to .
Output Format
An integer representing the lexicographical order of the given permutation.
Sample
4
21438
Related
In following homework: