#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
t=1;
// cin >> t;
while (t--){
int n;
cin >> n;
int m; cin >> m;
int k; cin >> k;
int A[n];
for(int i=0;i<n;i++){
cin >> A[i];
}
int B[m];
for(int i=0;i<m;i++){
cin >> B[i];
}
sort(A,A+n);
sort(B,B+m);
int f=0;
int l=0;
for(int i=0;i<n;i++){
for(int j=f;j<m;j++){
if(abs(A[i]-B[j])<=k){
l++;
f=j+1;
i++;
}
}
}
cout << l << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWludCB0OwoJdD0xOwoJLy8gY2luID4+IHQ7Cgl3aGlsZSAodC0tKXsKCQlpbnQgbjsKCWNpbiA+PiBuOwoJaW50IG07IGNpbiA+PiBtOwoJaW50IGs7IGNpbiA+PiBrOwoJaW50IEFbbl07Cglmb3IoaW50IGk9MDtpPG47aSsrKXsKCQljaW4gPj4gQVtpXTsKCX0KCWludCBCW21dOwoJZm9yKGludCBpPTA7aTxtO2krKyl7CgkJY2luID4+IEJbaV07Cgl9Cglzb3J0KEEsQStuKTsKCXNvcnQoQixCK20pOwoJaW50IGY9MDsKCWludCBsPTA7Cglmb3IoaW50IGk9MDtpPG47aSsrKXsKCQlmb3IoaW50IGo9ZjtqPG07aisrKXsKCQlpZihhYnMoQVtpXS1CW2pdKTw9ayl7CgkJCWwrKzsKCQkJZj1qKzE7CgkJCWkrKzsKCQl9CgkJfQoJfQoJY291dCA8PCBsIDw8IGVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==