#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); cin >> a; if(a[0] * a[n - 1] < 0){ int p = lower_bound(a.begin(), a.end(), 0) - a.begin(); // -2 -1 0 1 2 if(a[p] == 0){ cout << (6 * mint(2).pow(p - 1) * mint(2).pow(n - p - 2)).val() << '\n'; }else{ // -2 -1 1 2 cout << (2 * mint(2).pow(p - 1) * mint(2).pow(n - p - 1)).val() << '\n'; } }else{ cout << mint(2).pow(n - 1).val() << '\n'; } }