#include <bits/stdc++.h>
using namespace std;
const int maxn = 33;
const int Half = 18;
set<long long> vis;
map<long long, int> cnt[maxn];
int n, kk, a[maxn];
long long ans = 0;
long long half_ans[20], s;
inline void dfs1(int now, int v, int k, long long value) {
  if (value > s) return;
  if (now == v) {
    vis.insert(value);
    cnt[k][value]++;
    return;
  }
  int e = a[now];
  if (e <= Half && k < kk) dfs1(now + 1, v, k + 1, value + half_ans[e]);
  dfs1(now + 1, v, k, value + (long long)e);
  dfs1(now + 1, v, k, value);
  return;
}
void dfs2(int now, int v, int k, long long value) {
  if (value > s) return;
  if (now == v) {
    long long left = s - value;
    if (vis.count(left)) {
      int leftk = kk - k;
      for (int i = 0; i <= leftk; i++) ans += cnt[i][left];
    }
    return;
  }
  int e = a[now];
  if (e <= Half) dfs2(now + 1, v, k + 1, value + half_ans[e]);
  dfs2(now + 1, v, k, value + (long long)e);
  dfs2(now + 1, v, k, value);
}
int main() {
  half_ans[0] = 1;
  for (int i = 1; i <= Half; i++) half_ans[i] = half_ans[i - 1] * i;
  scanf("%d%d%I64d", &n, &kk, &s);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  dfs1(0, n / 2, 0, 0L);
  dfs2(n / 2, n, 0, 0L);
  printf("%I64d\n", ans);
  return 0;
}
