#include <bits/stdc++.h>
using namespace std;
long long u[25], x[30], s, ans;
map<long long, int> sum[30];
int n, k;
void backtrack1(int a, int b, long long c) {
  if (c > s) return;
  if (a == n / 2)
    sum[b][c]++;
  else {
    backtrack1(a + 1, b, c);
    backtrack1(a + 1, b, c + x[a]);
    if (x[a] < 19 && b < k) backtrack1(a + 1, b + 1, c + u[x[a]]);
  }
}
void backtrack2(int a, int b, long long c) {
  if (c > s) return;
  if (a == n) {
    for (int i = 0; i <= k - b; i++) {
      if (sum[i].count(s - c)) ans += sum[i][s - c];
    }
  } else {
    backtrack2(a + 1, b, c);
    backtrack2(a + 1, b, c + x[a]);
    if (x[a] < 19 && b < k) backtrack2(a + 1, b + 1, c + u[x[a]]);
  }
}
int main() {
  cin >> n >> k >> s;
  u[0] = 1LL;
  for (int i = 1; i < 20; i++) u[i] = u[i - 1] * i * 1LL;
  for (int i = 0; i < n; i++) cin >> x[i];
  backtrack1(0, 0, 0);
  backtrack2(n / 2, 0, 0);
  cout << ans;
}
