Given a permutation of n numbers from 1 to n. Find its number in the lexicographic order.
The first line contains the integer n (1≤n≤12). The next line contains the permutation of n numbers.
Print the permutation number in lexicographical order.