#include using namespace std; using ll=long long; constexpr int MOD=998244353; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector P(N,0); for(int &i:P)cin>>i,--i; vector idx(N,0); for(int i=0;iok; for(int i=0;i