You are given an array which is initially a permutation of $$$n$$$ elements: $$$A=[a_1, a_2, \dots, a_n]$$$.
The array can be modified using the following operation:
Print the number of different arrays that you can get by performing the given operation any number of times (possibly zero) modulo $$$998244353$$$.
The first line contains an integer $$$n$$$ ($$$1 \leq n \leq 5000$$$).
The following line contains $$$n$$$ space-separated integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \leq a_i \leq n$$$). It is guaranteed that $$$[a_1, a_2, \dots, a_n]$$$ forms a permutation of size $$$n$$$.
Print the answer modulo $$$998244353$$$.
5 1 2 3 4 5
16
5 3 5 2 4 1
9
| Название |
|---|


