#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
/*```````````````````````````****Defined macros*****``````````````````````````*/
const int mod = 1e9 + 7;
#define ll long long
#define endl "\n"
#define ull unsigned long long
#define pb push_back
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define set_bits __builtin_popcountll
#define all(x) x.begin(), x.end()
#define vll vector<ll>
#define vii vector<int>
#define tll takein<ll>
#define tii takein<int>
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class K, class V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
/*```````````````````````````````//DEBUGGER``````````````````````````````````*/
#ifndef ONLINE_JUDGE
#define _debug(x) cerr << #x <<" "; _print(x); cerr << endl;
#else
#define _debug(x)
#endif
template<typename T>void _print(T x){cerr<<x;}
template <class T, class V> void _print(pair <T, V> p);
template <class T> void _print(vector <T> v);
template <class T> void _print(set <T> v);
template <class T, class V> void _print(map <T, V> v);
template <class T> void _print(multiset <T> v);
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";}
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
template< typename T> vector<T> takein(int n){vector<T>A;for(int i=0;i<n;i++){T x;cin>>x;A.push_back(x);}return A;}
template< typename T> vector<T> presum(vector<T>&A){vector<T>ans(A.size(),0);ans[0]=A[0];for(int i=1;i<A.size();i++){ans[i]=ans[i-1]+A[i];}return ans;}
template <typename T> void idxocc(vector<T>A,vector<vector<T>>idx){for(int i = 0; i < A.size(); i++) {T a;cin >> a;idx[a].push_back(i);}}
template<typename T>void print_arr(vector<T>ans){for(auto i:ans){cout<<i<<" ";}cout<<endl;}
ll fastExp(int N,int R){ll ans = 1;while (R > 0){if (R % 2 == 1){ans = (ans* 1LL * N);}N = (N *1LL* N);R = R >> 1;}return ans;}
/*```````````````````````````````//predefined f(x)``````````````````````````````````*/
int x_Nx = 1e5 + 1;
vector<bool> prime(x_Nx, 1);
void primality(){prime[1] = prime[0] = 0;for (int i = 2; i * i <= x_Nx; i++){if (prime[i] == 1){for (int j = i * i; j <= x_Nx; j = j + i){prime[j] = 0;}}}return;}
// use binsea snippet for Binary_search code
//ceil(A/B)=(A+B-1)/B
//log2(A)==Highest set bit in A
/*```````````````````````````````//solution``````````````````````````````````*/
void solve()
{
//solve the question here
int n,m;
cin>>n>>m;
ll k;
cin>>k;
map<ll,ll>mp;
for(int i=0;i<n;i++){
ll x;
cin>>x;
mp[x]++;
}
vll B=tll(m);
int ans=0;
for(int i=0;i<m;i++){
auto it=mp.lower_bound(B[i]-k);
if(it!=mp.end()){
ll x=it->first;
if(x<=B[i]+k)
{ mp[x]--;
if(mp[x]==0){
mp.erase(x);
}
ans++;
}
}
}
cout<<ans<<endl;
}
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
srand(chrono::high_resolution_clock::now().time_since_epoch().count());
/*#ifndef ONLINE_JUDGE
freopen("Error.txt", "w", stderr);
#endif*/
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}