#include using namespace std; template using vec = vector; template using vvec = vector>; int main() { int n; cin >> n; vec> bal(n); for (auto &[x, y]: bal) cin >> x >> y; using dist_t = array; priority_queue, greater> que; for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { int ax = bal[i][0], ay = bal[i][1]; int bx = bal[j][0], by = bal[j][1]; int dx = abs(ax - bx), dy = abs(ay - by); int dist = 0; if (ax == bx || ay == by) { dist = (max(dx, dy) + 1) / 2; } else { dist = (max(dx, dy)) / 2 + 1; } que.push({ dist, i, j }); } } int ans = 0; vec used(n, false); while (que.size()) { auto [d, a, b] = que.top(); que.pop(); if (used[a] || used[b]) continue; tie(a, b) = make_tuple(min(a, b), max(a, b)); used[a] = a != 0; used[b] = true; ans += a == 0; } cout << ans << endl; }