Number of permutation
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Given a permutation of numbers from to . Find its number in the lexicographic order.
Input
The first line contains the integer . The next line contains the permutation of numbers.
Output
Print the permutation number in lexicographical order.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 42%