# 9.15 顺丰编程笔试题

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>
// #include <unistd.h>
#include <unordered_map>

using namespace std;

#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define fi first
#define se second
#define mst(a, b) memset(a, b, sizeof a)
#define lson (rt << 1)
#define rson ((rt << 1) | 1)

const int qq = 1e5 + 10;
const int INF = 1e9 + 10;
const int MOD = 1e9 + 7;
string st;
int num[qq], n = 0;

void modify(int start) {
int son = dad * 2 + 1;
while (son < n) {
if (son + 1 < n && num[son + 1] > num[son]) {
son++;
}
return;
}
son = dad * 2 + 1;
}
}

int main() {
#ifdef ONLINE_JUDGE
#else
freopen("in.txt", "r", stdin);
#endif
cin >> st;
int cnt = 0;
for (int i = 0; i < st.size(); ++i) {
if (!isdigit(st[i]))    continue;
int c = i, tmp = 0;
while (isdigit(st[c]) && c < st.size()) {
tmp = tmp * 10 + st[c] - '0';
c++;
}
num[n++] = tmp;
i = c;
}
//  cout << st << endl;
// stringstream os(st);
// n = 0;
// while (os >> num[n++]);
//  printf("%d\n", n);
// n--;
for (int i = (n - 1) / 2; i >= 0; --i) {
modify(i);
}
for (int i = 0; i < n; ++i) {
printf("%d%c", num[i], i == n - 1 ? '\n' : ',');
}
return 0;
}
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>
// #include <unistd.h>
#include <unordered_map>

using namespace std;

#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define fi first
#define se second
#define mst(a, b) memset(a, b, sizeof a)
#define lson (rt << 1)
#define rson ((rt << 1) | 1)

const int qq = 1e5 + 10;
const int INF = 1e9 + 10;
const int MOD = 1e9 + 7;
int dp[qq], num[qq], n = 0;
string st;

int main() {
#ifdef ONLINE_JUDGE
#else
freopen("in.txt", "r", stdin);
#endif
int t;  cin >> t;
cin >> st;
n = 0;
int sum = 0;
for (int i = 0; i < st.size(); ++i) {
if (!isdigit(st[i]))    continue;
int c = i, tmp = 0;
while (isdigit(st[c]) && c < st.size()) {
tmp = tmp * 10 + st[c] - '0';
c++;
}
i = c;
num[n++] = tmp;
sum += tmp;
}
//  printf("%d\n", n);
// stringstream os(st);
// int sum = 0;
// while (os >> num[n++]) {
//  sum += num[n - 1];
// }
//  printf("qqq = %d\n", n);
dp[0] = 1;
for (int i = 0; i < n; ++i) {
for (int j = sum; j - num[i] >= 0; --j) {
dp[j] += dp[j - num[i]];
}
}
if (t == 0) dp[0] -= 1;
printf("%d\n", dp[t]);
return 0;
}