#include <iostream>
using namespace std;
#include<set>
int main(){
int n,c;
cin>>n>>c;
multiset<int>a;
while(n--){
int b;
cin>>b;
a.insert(b);
}
int e=0;
for (auto it=a.begin();it!=a.end();it++){
e+=a.count(*it+c);
}
if (c==0){
cout<<n;
}
else{
cout<<e;
}
return 0;
}

京公网安备 11010502036488号