#include<iostream>
#include<algorithm>
#include<tuple>
using namespace std;
#define MAX_N 1200000
long long x1_AB[MAX_N];
long long x1_AC[MAX_N];
long long x2_AB[MAX_N];
long long x2_AC[MAX_N];
long long x1_E[MAX_N];
long long x2_E[MAX_N];
tuple<long long, long long, long long>x2_ALL[MAX_N];
long long n, d, f, a[30], mid1, mid2, A, B, C, E, P, M1, M2, P1, P2, sum;
long long power[30], cnt, cnt2;
int main() {
power[0] = 1; for (int i = 1; i < 30; i++) { power[i] = power[i - 1] * 4; }
cin >> n >> d >> f;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
mid1 = n / 2;
mid2 = n - mid1;
cnt = 0;
for (int i = 0; i < power[mid1]; i++) {
A = 0; B = 0; C = 0; E = 0;
for (int j = 0; j < mid1; j++) {
P = (i / power[j]) % 4;
if (P == 0) {
A += a[j];
}
if (P == 1) {
B += a[j];
}
if (P == 2) {
C += a[j];
}
if (P == 3) {
E += 1;
}
}
if (E <= f) {
x1_AB[cnt] = A - B;
x1_AC[cnt] = A - C;
x1_E[cnt] = E;
cnt++;
}
}
cnt2 = 0;
for (int i = 0; i < power[mid2]; i++) {
A = 0; B = 0; C = 0; E = 0;
for (int j = 0; j < mid2; j++) {
P = (i / power[j]) % 4;
if (P == 0) {
A += a[j + mid1];
}
if (P == 1) {
B += a[j + mid1];
}
if (P == 2) {
C += a[j + mid1];
}
if (P == 3) {
E += 1;
}
}
if (E <= f) {
x2_AB[cnt2] = A - B;
x2_AC[cnt2] = A - C;
x2_E[cnt2] = E;
cnt2++;
}
}
for (int i = 0; i < cnt2; i++) {
x2_ALL[i] = make_tuple(x2_AB[i], x2_AC[i], x2_E[i]);
}
sort(x2_ALL, x2_ALL + cnt2);
for (int i = 0; i < cnt2; i++) {
x2_AB[i] = get<0>(x2_ALL[i]);
x2_AC[i] = get<1>(x2_ALL[i]);
x2_E[i] = get<2>(x2_ALL[i]);
}
for (int i = 0; i < cnt; i++) {
M1 = -x1_AB[i] - d;
M2 = -x1_AB[i] + d;
P1 = lower_bound(x2_AB, x2_AB + cnt2, M1) - x2_AB;
P2 = upper_bound(x2_AB, x2_AB + cnt2, M2) - x2_AB;
for (int j = P1; j < P2; j++) {
if (abs(x1_AC[i] + x2_AC[j]) <= d && x1_E[i] + x2_E[j] <= f) {
sum++;
}
}
}
cout << sum << endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2luY2x1ZGU8dHVwbGU+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIE1BWF9OIDEyMDAwMDAKCmxvbmcgbG9uZyB4MV9BQltNQVhfTl07CmxvbmcgbG9uZyB4MV9BQ1tNQVhfTl07CmxvbmcgbG9uZyB4Ml9BQltNQVhfTl07CmxvbmcgbG9uZyB4Ml9BQ1tNQVhfTl07CmxvbmcgbG9uZyB4MV9FW01BWF9OXTsKbG9uZyBsb25nIHgyX0VbTUFYX05dOwp0dXBsZTxsb25nIGxvbmcsIGxvbmcgbG9uZywgbG9uZyBsb25nPngyX0FMTFtNQVhfTl07CmxvbmcgbG9uZyBuLCBkLCBmLCBhWzMwXSwgbWlkMSwgbWlkMiwgQSwgQiwgQywgRSwgUCwgTTEsIE0yLCBQMSwgUDIsIHN1bTsKbG9uZyBsb25nIHBvd2VyWzMwXSwgY250LCBjbnQyOwoKaW50IG1haW4oKSB7Cglwb3dlclswXSA9IDE7IGZvciAoaW50IGkgPSAxOyBpIDwgMzA7IGkrKykgeyBwb3dlcltpXSA9IHBvd2VyW2kgLSAxXSAqIDQ7IH0KCWNpbiA+PiBuID4+IGQgPj4gZjsKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJY2luID4+IGFbaV07Cgl9CgoJbWlkMSA9IG4gLyAyOwoJbWlkMiA9IG4gLSBtaWQxOwoKCWNudCA9IDA7CgoJZm9yIChpbnQgaSA9IDA7IGkgPCBwb3dlclttaWQxXTsgaSsrKSB7CgkJQSA9IDA7IEI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