#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int INF = (int)1e9 + 1;
const long double EPS = 1e-9;
const int maxf = 60;
long long fact[maxf];
long long S;
int big;
void gen(int iter, long long val, int leftFact, int k, int n, int *a,
         vector<vector<long long> > &res) {
  if (val > S) {
    return;
  }
  if (iter == n) {
    res[k - leftFact].push_back(val);
    return;
  }
  gen(iter + 1, val, leftFact, k, n, a, res);
  gen(iter + 1, val + a[iter], leftFact, k, n, a, res);
  if (leftFact && a[iter] < big) {
    gen(iter + 1, val + fact[a[iter]], leftFact - 1, k, n, a, res);
  }
}
vector<vector<long long> > getNums(int *a, int n, int k) {
  vector<vector<long long> > res(k + 1);
  gen(0, 0, k, k, n, a, res);
  return res;
}
const int maxn = 25 + 5;
int a[maxn];
bool solve() {
  int n, k;
  if (scanf("%d%d"
            "%lld",
            &n, &k, &S) < 3) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  fact[0] = 1;
  big = 1;
  while (big < maxf) {
    fact[big] = fact[big - 1] * big;
    if (fact[big] > S) {
      break;
    }
    ++big;
  }
  assert(big < maxf);
  int ns[2] = {n / 2, (n + 1) / 2};
  vector<vector<long long> > as[2] = {getNums(a, ns[0], k),
                                      getNums(a + ns[0], ns[1], k)};
  long long res = 0;
  vector<long long> cur, ncur;
  for (int i = k; i >= 0; --i) {
    {
      vector<long long> &toadd = as[1][k - i];
      sort(toadd.begin(), toadd.end());
      ncur.resize(((int)(cur).size()) + ((int)(toadd).size()));
      merge(&toadd[0], &toadd[0] + ((int)(toadd).size()), &cur[0],
            &cur[0] + ((int)(cur).size()), &ncur[0]);
      swap(cur, ncur);
    }
    for (int j = 0; j < ((int)(as[0][i]).size()); ++j) {
      long long val = as[0][i][j];
      res += upper_bound(cur.begin(), cur.end(), S - val) -
             lower_bound(cur.begin(), cur.end(), S - val);
    }
  }
  printf(
      "%lld"
      "\n",
      res);
  return 1;
}
int main() {
  srand(rdtsc());
  while (1) {
    if (!solve()) {
      break;
    }
  }
  return 0;
}
