#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
  int a;
  int b;
  int c;
  cin>>a>>b>>c;
  vector<int>v;
  vector<int>v2;
  for(int y=0; y<a; y++){
   int y1;
   cin>>y1;
   v.push_back(y1);
  }

  for(int y2=0; y2<b; y2++){
   int y3;
   cin>>y3;
   v2.push_back(y3);
  }
  sort(v.begin(),v.end());
  sort(v2.begin(),v2.end());

  int i=0;
  int j=0;

  int brojac=0;
  while((i<a)and(j<b)){
  if(abs(v[i]-v2[j])<=c){
   brojac+=1;
   i+=1;
   j+=1;
  }
  else {
    if(v[i]>v2[j]){
    j+=1;
    }
    else if(v[i]<v2[j]){
        i+=1;
    }
  }
  }
  cout<<brojac;
    return 0;
}
