import java.util.*; public class Main { static class Point { int x; int y; Point(int x, int y) { this.x = x; this.y = y; } double dist(Point o) { return Math.sqrt((this.x - o.x) * (this.x - o.x) + (this.y - o.y) * (this.y - o.y)); } @Override public String toString() { return "(" + this.x + ", " + this.y + ")"; } } static int getId(int x, int y) { return x * 1001 + y; } static int[] dirx = new int[]{0, 1, 0, -1, 0, 1, 1, -1, -1}; static int[] diry = new int[]{0, 0, 1, 0, -1, 1, -1, 1, -1}; public static void main(String[] argv) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int res = 0; Map> data = new HashMap>(); for (int i = 0; i < n; i++) { int x = scanner.nextInt(); int y = scanner.nextInt(); Point p = new Point(x, y); x /= 20; y /= 20; boolean overwrap = false; for (int j = 0; j < dirx.length; j++) { int nx = dirx[j] + x; int ny = diry[j] + y; if (nx < 0 || ny < 0 || nx > 1001 || ny > 1001) continue; int newKey = getId(nx, ny); if (data.containsKey(newKey)) { List points = data.get(newKey); for (Point p2 : points) { // System.out.println("compare:" + p.toString() + " : " + p2.toString()); if (p.dist(p2) < 20) { // System.out.println("overwrap!!"); overwrap = true; break; } } } if (overwrap) { break; } } if (!overwrap) { List list; int id = getId(x, y); if (data.containsKey(id)) { list = data.get(id); } else { list = new ArrayList(); data.put(id, list); } // System.out.println("add:" + id + ":" + p.toString()); res++; list.add(p); } } System.out.println(res); } }