#include <bits/stdc++.h>
using namespace std;
constexpr long long R = 1e3 + 69, INF = 2e9 + 6969, mod = 998244353;
long long n, a[R], dp[R], fact[R], rev[R];
long long choose(long long N, long long K) {
  long long cur = (fact[N] * rev[K]) % mod;
  cur = (cur * rev[N - K]) % mod;
  return cur;
}
long long Pow(long long a, long long p) {
  long long w = 1;
  while (p) {
    if (p & 1) w = (w * a) % mod;
    a = (a * a) % mod;
    p >>= 1;
  }
  return w;
}
int main() {
  scanf("%lld", &n);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  fact[0] = 1;
  for (int i = 1; i <= n; ++i) fact[i] = (i * fact[i - 1]) % mod;
  rev[n] = Pow(fact[n], mod - 2);
  for (int i = n - 1; i >= 0; --i) rev[i] = (rev[i + 1] * (i + 1)) % mod;
  dp[n] = 1;
  for (int i = n - 1; i >= 0; --i) {
    if (a[i] <= 0 || a[i] + i >= n) continue;
    for (int j = i + a[i] + 1; j <= n; ++j) {
      dp[i] += (dp[j] * choose(j - i - 1, a[i])) % mod;
      dp[i] %= mod;
    }
  }
  long long sum = 0;
  for (int i = 0; i < n; ++i) sum = (sum + dp[i]) % mod;
  printf("%lld\n", sum);
  return 0;
}
