#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int n, a[maxn], s[maxn];
long long f[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  f[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j)
      if (s[i] - s[j] == 1) f[i] += f[j];
  }
  cout << f[n];
  return 0;
}
