#include <bits/stdc++.h>
using namespace std;
const int MAXN = 40;
const long long INF = 1e18;
int n, k, i, lg, lz, rz, M, SM;
long long ans, s;
long long a[MAXN];
long long fct[MAXN];
long long lu[1 << (MAXN / 2)];
long long lf[1 << (MAXN / 2)];
long long ru[1 << (MAXN / 2)];
long long rf[1 << (MAXN / 2)];
unordered_map<int, long long> leftcnt[MAXN];
long long ask_fct(int n) { return (n <= 20 ? fct[n] : INF); }
void ad(long long &a, long long v) {
  if (max(a, v) == INF)
    a = INF;
  else
    a += v;
}
void workleft(int M, int SM) {
  assert((M & SM) == SM);
  if (__builtin_popcount(SM) > k) return;
  if (lf[SM] == INF) return;
  long long S = lu[M] - lu[SM] + lf[SM];
  if (S > s) return;
  leftcnt[__builtin_popcount(SM)][S]++;
}
void workright(int M, int SM) {
  assert((M & SM) == SM);
  if (__builtin_popcount(SM) > k) return;
  if (rf[SM] == INF) return;
  long long S = ru[M] - ru[SM] + rf[SM];
  if (S > s) return;
  for (int kk = 0; kk + __builtin_popcount(SM) <= k; kk++) {
    if (leftcnt[kk].count(s - S)) ans += leftcnt[kk][s - S];
  }
}
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  fct[0] = 1;
  for (i = 1; i <= 20; i++) {
    fct[i] = 1LL * i * fct[i - 1];
  }
  cin >> n >> k >> s;
  for (i = 1; i <= n; i++) cin >> a[i];
  if (n == 1) {
    if (a[1] == s) ans++;
    if (k >= 1 && ask_fct(a[1]) == s) ans++;
    cout << ans << "\n";
    return 0;
  }
  lg = n / 2;
  lz = lg, rz = n - lz;
  for (M = 0; M < (1 << lz); M++) {
    for (i = 1; i <= lg; i++) {
      if (!(M & (1 << (i - 1)))) continue;
      ad(lu[M], a[i]);
      ad(lf[M], ask_fct(a[i]));
    }
  }
  for (M = 0; M < (1 << rz); M++) {
    for (i = lg + 1; i <= n; i++) {
      if (!(M & (1 << (i - lg - 1)))) continue;
      ad(ru[M], a[i]);
      ad(rf[M], ask_fct(a[i]));
    }
  }
  for (M = 0; M < (1 << lz); M++) {
    for (SM = M; SM; SM = (SM - 1) & M) {
      workleft(M, SM);
    }
    workleft(M, 0);
  }
  for (M = 0; M < (1 << rz); M++) {
    for (SM = M; SM; SM = (SM - 1) & M) {
      workright(M, SM);
    }
    workright(M, 0);
  }
  cout << ans << "\n";
  return 0;
}
