[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
create const int N = 1e5 + 5
create const long long mod = 998244353
declare 3d long long array dp with size N by 201 by 3
let a be int array with size N
define the main function
    declare integer variable n
    read n
    for i from 1 to n + 1 exclusive, read input to a[i]
    set sizeof(dp) bytes at the pointer dp to 0
    for i = 1 to 201 exclusive
        if a[1] = -1 or a[1] = i, set dp[1][i][2] to 1
    end of the block
    create long long sum = 0
    for i = 2 to n inclusive
        assign 0 to sum
        for integer j = 200 to 1 inclusive, decrementing j
            if a[i] = -1 or a[i] = j, change dp[i][j][0] to sum
            assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0]) % mod to sum
        end of the block
        for j from 1 to 201 exclusive
            if a[i] = -1 or a[i] = j, set dp[i][j][1] to (dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod
        end of the block
        change sum to 0
        for integer j = 1 to 200 inclusive
            if a[i] = -1 or a[i] = j, set dp[i][j][2] to sum
            assign (sum + dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod to sum
        end of the block
    end of the block
    declare long long variable ans = 0
    for i = 1 to 200 inclusive, change ans to (ans + dp[n][i][1] + dp[n][i][0]) % mod
    print ans
    return to indicate successful execution
end of the block

[CODE]:

const int N = 1e5 + 5;
const long long mod = 998244353;
long long dp[N][201][3];
int a[N];
int main() {
    int n;
    cin >> n;
    for (int i = (1); i < (n + 1); i++) cin >> a[i];
    memset(dp, 0, sizeof(dp));
    for (int i = (1); i < (201); i++) {
        if (a[1] == -1 || a[1] == i) { dp[1][i][2] = 1; }
    }
    long long sum = 0;
    for (int i = 2; i <= n; ++i) {
        sum = 0;
        for (int j = 200; j >= 1; --j) {
            if (a[i] == -1 || a[i] == j) { dp[i][j][0] = sum; }
            sum = (sum + dp[i - 1][j][1] + dp[i - 1][j][0]) % mod;
        }
        for (int j = (1); j < (201); j++) {
            if (a[i] == -1 || a[i] == j) { dp[i][j][1] = (dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod; }
        }
        sum = 0;
        for (int j = 1; j <= 200; ++j) {
            if (a[i] == -1 || a[i] == j) { dp[i][j][2] = sum; }
            sum = (sum + dp[i - 1][j][1] + dp[i - 1][j][0] + dp[i - 1][j][2]) % mod;
        }
    }
    long long ans = 0;
    for (int i = 1; i <= 200; ++i) ans = (ans + dp[n][i][1] + dp[n][i][0]) % mod;
    cout << ans << endl;
    return 0;
}