#include <bits/stdc++.h>
using namespace std;
const int maxT = 19, maxn = 30;
const long long f[20] = {1ll,
                         1ll,
                         2ll,
                         6ll,
                         24ll,
                         120ll,
                         720ll,
                         5040ll,
                         40320ll,
                         362880ll,
                         3628800ll,
                         39916800ll,
                         479001600ll,
                         6227020800ll,
                         87178291200ll,
                         1307674368000ll,
                         20922789888000ll,
                         355687428096000ll,
                         6402373705728000ll,
                         121645100408832000ll};
int n, k, n2;
int a[maxn];
long long s, ans = 0;
map<long long, vector<long long> > m;
void push(long long v, int j) {
  map<long long, vector<long long> >::iterator p = m.find(v);
  if (p == m.end()) {
    vector<long long> t;
    t.resize(maxn);
    t[j]++;
    m[v] = t;
  } else {
    p->second[j]++;
  }
}
void dfs1(int i, int j, long long v) {
  if (i >= n2) {
    push(v, j);
    return;
  }
  dfs1(i + 1, j, v);
  if (v + a[i] <= s) dfs1(i + 1, j, v + a[i]);
  if (j < k && a[i] <= 19 && v + f[a[i]] <= s) dfs1(i + 1, j + 1, v + f[a[i]]);
}
void dfs2(int i, int j, long long v) {
  if (i >= n) {
    map<long long, vector<long long> >::iterator p = m.find(s - v);
    if (p != m.end()) {
      for (int l = 0; l <= k - j; l++) {
        ans += p->second[l];
      }
    }
    return;
  }
  dfs2(i + 1, j, v);
  if (v + a[i] <= s) dfs2(i + 1, j, v + a[i]);
  if (j < k && a[i] <= 19 && v + f[a[i]] <= s) dfs2(i + 1, j + 1, v + f[a[i]]);
}
int main() {
  scanf("%d%d%I64d", &n, &k, &s);
  n2 = n / 2;
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  dfs1(0, 0, 0);
  dfs2(n / 2, 0, 0);
  printf("%I64d\n", ans);
  return 0;
}
