题目描述
Given is a sequence of $N$ integers: $A=(A_1,A_2,\ldots,A_N)$.
Find the number of (not necessarily contiguous) subsequences $A'=(A_1',A_2',\ldots,A_k')$ of length at least $2$ that satisfy the following condition:
- $A_1' \le A_k'$.
Since the count can be enormous, print it modulo $998244353$.
Here, two subsequences are distinguished when they originate from different sets of indices, even if they are the same as sequences.
输出格式
Print the number of (not necessarily contiguous) subsequences $A'=(A_1',A_2',\ldots,A_k')$ of length at least $2$ that satisfy the condition in Problem Statement.
提示
***For Sample #1:***
$A=(1,2,1)$ has four (not necessarily contiguous) subsequences of length at least $2$: $(1,2)$, $(1,1)$, $(2,1)$, $(1,2,1)$.
Three of them, $(1,2)$, $(1,1)$, $(1,2,1)$, satisfy the condition in Problem Statement.
***For Sample #2:***
Note that two subsequences are distinguished when they originate from different sets of indices, even if they are the same as sequences.
In this Sample, there are four subsequences, $(1,2)$, $(1,2)$, $(2,2)$, $(1,2,2)$, that satisfy the condition.
***For Sample #3:***
There may be no subsequence that satisfies the condition.
***For Sample #4:***
Print the answer modulo $998244353$.