#include <bits/stdc++.h>
using namespace std;
void func(void) {
  freopen("input.c", "r", stdin);
  freopen("output.c", "w", stdout);
}
void print(vector<long long> &v) {
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    printf("%lld ", v[i]);
  }
  printf("\n");
}
void print(vector<pair<long long, long long> > &v) {
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    printf("%lld %lld\n", v[i].first, v[i].second);
  }
}
void print(double d) { cout << fixed << setprecision(10) << d << endl; }
void print(string s, double d) {
  cout << s << " ";
  cout << fixed << setprecision(10) << d << endl;
}
vector<long long> v;
const int N = 1e3 + 1000;
long long n;
long long dp[N][2][N];
long long calc(long long i, long long nisi, long long baki) {
  if (i == n) {
    if (baki) return 0;
    return nisi;
  }
  if (dp[i][nisi][baki] != -1) return dp[i][nisi][baki];
  long long x = 0;
  if (v[i] <= 0) {
    if (baki) x += calc(i + 1, nisi, baki - 1);
    x += calc(i + 1, nisi, baki);
    x %= 998244353;
  } else if (v[i] + i + 1 <= n and baki == 0) {
    x += calc(i + 1, 1, v[i]);
    x %= 998244353;
    x += calc(i + 1, nisi, baki);
    x %= 998244353;
  } else {
    if (baki) x += calc(i + 1, nisi, baki - 1);
    x += calc(i + 1, nisi, baki);
    x %= 998244353;
  }
  return dp[i][nisi][baki] = x;
}
int main() {
  long long q, i, j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m,
                  fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000,
                  mn1 = 8000000000000000000;
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    v.push_back(x);
  }
  memset((dp), -1, sizeof(dp));
  cout << calc(0, 0, 0) << endl;
}
