#include <bits/stdc++.h>
int main(void) {
  int N, i, j;
  scanf("%d", &N);
  int A[N];
  int max = -1e9;
  int min = 1e9;
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    if (A[i] > max) {
      max = A[i];
    } else if (A[i] < min) {
      min = A[i];
    }
  }
  if (min > 0 || max < 0) {
    printf("0");
  } else {
    int dp[N + 1][100000001];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (i = 0; i < N; i++) {
      for (j = min; j <= 0; j++) {
        dp[i + 1][j - min] += dp[i][j - min];
        if (j >= A[i]) {
          dp[i + 1][j - min] += dp[i][j - min - A[i]];
        }
      }
    }
    printf("%d", dp[N][0]);
  }
}
