题目描述
Problem Description
Determine the rank of a given permutation of $1\sim N$ among all permutations of $1\sim N$. The result should be taken modulo $998244353$.
Input Format
The first line contains a positive integer $N$.
The second line contains $N$ positive integers, representing a permutation of $1\sim N$.
Output Format
A single line containing a non-negative integer, representing the answer modulo $998244353$.
Sample Input and Output
Sample Input #1
3
2 1 3
Sample Output #1
3
Sample Input #2
4
1 2 4 3
Sample Output #2
2
Notes
For $10\%$ of the data, $1 \le N \le 10$.
For $50\%$ of the data, $1 \le N \le 5000$.
For $100\%$ of the data, $1 \le N \le 1000000$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3
2 1 3
样例输出
3