#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int INF = 1000000001;
long long f[20], s, a[25];
int n, k;
map<long long, int> l[26], r[26];
long long result = 0;
void solve(int index, int end, long long value, map<long long, int> used[],
           int usedItems);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  f[0] = 1;
  for (long long i = 1; i <= 19; i++) f[i] = f[i - 1] * i;
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  solve(0, n / 2, 0, l, 0);
  solve(n / 2, n, 0, r, 0);
  for (int i = 0; i <= k; i++) {
    for (auto it : l[i]) {
      for (int j = 0; j + i <= k; j++) result += it.second * r[j][s - it.first];
    }
  }
  cout << result << "\n";
  return 0;
}
void solve(int index, int end, long long value, map<long long, int> used[],
           int usedItems) {
  if (index == end) {
    used[usedItems][value]++;
    return;
  }
  solve(index + 1, end, value + a[index], used, usedItems);
  solve(index + 1, end, value, used, usedItems);
  if ((usedItems < k) && (a[index] < 19))
    solve(index + 1, end, value + f[a[index]], used, usedItems + 1);
}
