please tell me my mistake
#include <bits/stdc++.h>
using namespace std;
bool compare(pair<int,int> p1,pair<int,int>p2){
return p1.second<p2.second;
}
int main()
{
int n;
cin >> n;
vector<pair<int, int>> v;
while (n--)
{
int c, r;
cin >> c >> r;
int start = c - r;
int end = c + r;
v.push_back(make_pair(start,end));
}
sort(v.begin(),v.end(),compare);
int cnt=0;
int current = v[0].second;
for(int i=1;i<n;i++){
if(v[i].first<=current){
cnt++;
current = v[i].second;
}
}
cout<<cnt<<endl;
return 0;
}