#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define MAXN 100005
#define Point pair<int, int>
#define x first
#define y second
#define mp make_pair
using namespace std;

int n, ps1, ps2, d, cntD[MAXN];
long long sol;
Point p[MAXN];
bool uz[MAXN];
unordered_map< int, vector< pair<int, int> > > vplus, vminus;
vector<int> G[MAXN];

inline int getMinusIdx(int x) {
    return x + MAXN;
}

inline int getManhattan(int idx1, int idx2) {
    return abs(p[idx1].x - p[idx2].x) + abs(p[idx1].y - p[idx2].y);
}

bool Comp(pair<int, int> a, pair<int, int> b) {
    return p[a.first].x < p[b.first].x;
}

void getVectorRange(vector< pair<int, int> > &v, int xmin, int xmax, int idx) {
    p[0] = make_pair(xmin, 0);
    auto itl = lower_bound(v.begin(), v.end(), mp(0, 0), Comp);
    p[0] = make_pair(xmax, 0);
    auto itr =  upper_bound(v.begin(), v.end(), mp(0, 0), Comp);

    int cnt = distance(itl, itr);
    cntD[idx] += cnt;
    
    if(cnt > 0) {
        itl->second++;
        itr--;
        itr->second--;
        G[idx].push_back(itl->first);
        G[itl->first].push_back(idx);
    }
}

void computeNeighbours(int idx) {
    int plus  = p[idx].x + p[idx].y;
    int minus = p[idx].x - p[idx].y;

    if(1LL * plus + d == plus + d && vplus.count(plus + d))
        getVectorRange(vplus[plus + d], p[idx].x + 1, p[idx].x + d, idx);
    if(vplus.count(plus - d))
        getVectorRange(vplus[plus - d], p[idx].x - d, p[idx].x - 1, idx);
    if(vminus.count(minus + d))
        getVectorRange(vminus[minus + d], p[idx].x, p[idx].x + d - 1, idx);
    if(1LL * minus - d == minus - d && vminus.count(minus - d))
        getVectorRange(vminus[minus - d], p[idx].x - d + 1, p[idx].x, idx);
}

void DFS(int u) {
    uz[u] = 1;
    for(auto x: G[u]) {
        if(!uz[x])
            DFS(x);
    }
}

int main() {

    scanf("%d %d %d", &n, &ps1, &ps2);
    for(int i = 1; i <= n; ++i) {
        scanf("%d %d", &p[i].x, &p[i].y);
        vplus[p[i].x + p[i].y].push_back(mp(i, 0));
        vminus[p[i].x - p[i].y].push_back(mp(i, 0));
    }

    for(auto &x: vplus)
        sort(x.second.begin(), x.second.end(), Comp);
    for(auto &x: vminus)
        sort(x.second.begin(), x.second.end(), Comp);

    d = getManhattan(ps1, ps2);
    for(int i = 1; i <= n; ++i)
        computeNeighbours(i);

    for(auto &x: vplus) {
        vector< pair<int, int> > &v = x.second;
        int cnt = 0;

        for(int i = 0; i < (int) v.size() - 1; ++i) {
            cnt += v[i].second;
            if(cnt > 0) {
                G[v[i].first].push_back(v[i + 1].first);
                G[v[i + 1].first].push_back(v[i].first);
            }
        }
    }
    for(auto &x: vminus) {
        vector< pair<int, int> > &v = x.second;
        int cnt = 0;

        for(int i = 0; i < (int) v.size() - 1; ++i) {
            cnt += v[i].second;
            if(cnt > 0) {
                G[v[i].first].push_back(v[i + 1].first);
                G[v[i + 1].first].push_back(v[i].first);
            }
        }
    }

    DFS(ps1);

    for(int i = 1; i <= n; ++i) {
        if(uz[i])
            sol += cntD[i];
    }

    printf("%lld\n", sol >> 1);

    return 0;
}

Measured memory_bytes: 24904