#include <bits/stdc++.h>
using namespace std;
long long a[27], fact[27], n, k, s, ans;
set<long long> vis;
map<long long, long long> maps[33];
void dfs1(long long now, long long stp, long long k1, long long v) {
  if (v > s) return;
  if (now == stp + 1) {
    vis.insert(v);
    maps[k1][v]++;
    return;
  }
  if (a[now] <= 18 && k > k1) {
    dfs1(now + 1, stp, k1 + 1, v + fact[a[now]]);
  }
  dfs1(now + 1, stp, k1, v + a[now]);
  dfs1(now + 1, stp, k1, v);
}
void dfs2(long long now, long long stp, long long k1, long long v) {
  if (v > s) return;
  if (now == stp + 1) {
    long long ext = s - v, k2 = k - k1;
    if (vis.count(ext)) {
      for (register long long i = 0; i <= k2; i++) {
        ans += maps[i][ext];
      }
    }
    return;
  }
  if (a[now] <= 18 && k > k1) {
    dfs2(now + 1, stp, k1 + 1, v + fact[a[now]]);
  }
  dfs2(now + 1, stp, k1, v + a[now]);
  dfs2(now + 1, stp, k1, v);
}
signed main() {
  fact[0] = 1;
  for (register long long i = 1; i <= 18; i++) {
    fact[i] = fact[i - 1] * i;
  }
  scanf("%lld%lld%lld", &n, &k, &s);
  for (register long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  dfs1(1, n / 2, 0, 0);
  dfs2(n / 2 + 1, n, 0, 0);
  printf("%lld", ans);
  return 0;
}
