#include using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll N,mod=998244353;; cin>>N; vector A(N),P(N+1,1); for(int i=0;i>A[i]; P[i+1]=(P[i]*2)%mod; } ll an=0; for(int i=0;i