#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N, V, P;
    int64_t M;
    cin >> N >> M >> V >> P;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    sort(A.rbegin(), A.rend());
    int Ab = A.at(P - 1);

    int64_t acc = 0;
    vector<int64_t> diff(N);
    for (int i = P; i < N; i++)
    {
        acc += Ab - A.at(i);
        diff.at(i) = acc;
    }

    int res = 0;
    for (int i = 0; i < N; i++)
    {
        if (i < P)
        {
            res++;
            continue;
        }
        int64_t Ai_mx = A.at(i) + M;
        if (Ai_mx >= Ab && V - P <= N - i - 1)
        {
            res++;
            continue;
        }
        int64_t v = M * (V - P - (N - i - 1));
        int64_t d = diff.at(i - 1);
        int Ab_mn = Ab;
        if (v > d)
        {
            v -= d;
            int n = i - (P - 1);
            Ab_mn += (v + n - 1) / n;
        }
        if (Ai_mx >= Ab_mn)
        {
            res++;
        }
    }
    cout << res << endl;
}
#include "bits/stdc++.h"

using namespace std;

void Main() {
    long long N;
    cin >> N;
    vector<long long> A(N, 0), B(N, 0), C(N, 0);
    for (long long i = 0; i < N; ++i) {
        cin >> A[i];
    }
    for (long long i = 0; i < N; ++i) {
        cin >> B[i];
    }
    for (long long i = 0; i < N; ++i) {
        cin >> C[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    vector<long long> fromAtoB(N, -1);
    vector<long long> fromBtoC(N, -1);
    for (long long i = 0; i < N; ++i) {
        fromAtoB[i] = distance(B.begin(), upper_bound(B.begin(), B.end(), A[i]));
    }
    for (long long i = 0; i < N; ++i) {
        fromBtoC[i] = distance(C.begin(), upper_bound(C.begin(), C.end(), B[i]));
    }

    vector<long long> BC(N, -1);
    for (long long i = 0; i < N; ++i) {
        BC[i] = N - fromBtoC[i];
    }
    vector<long long> accumBC(N, -1);
    for (long long i = N - 1; i >= 0; --i) {
        if (i == N - 1) {
            accumBC[i] = BC[i];
        }
        else {
            accumBC[i] = accumBC[i + 1] + BC[i];
        }
    }

    long long ans = 0;
    for (long long i = 0; i < N; ++i) {
        long long k = fromAtoB[i];
        if (k == N) {
            break;
        }
        ans += accumBC[k];
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}
