package contest; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Q476 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); LongHashSet lhs = new LongHashSet(); int o = 100000; int ret = 0; outer: for(int z = 0;z < n;z++){ int x = ni(), y = ni(); for(int i = 0;i <= 20;i++){ for(int j = 0;i*i+j*j < 400;j++){ if(lhs.contains((long)x+o+i<<32|y+o+j))continue outer; if(lhs.contains((long)x+o-i<<32|y+o+j))continue outer; if(lhs.contains((long)x+o+i<<32|y+o-j))continue outer; if(lhs.contains((long)x+o-i<<32|y+o-j))continue outer; } } lhs.add((long)x+o<<32|y+o); ret++; } out.println(ret); } public static class LongHashSet { public long[] keys; public boolean[] allocated; private int scale = 1<<2; private int rscale = 1<<1; private int mask = scale-1; public int size = 0; public LongHashSet(){ allocated = new boolean[scale]; keys = new long[scale]; } public boolean contains(long x) { int pos = h(x)&mask; while(allocated[pos]){ if(x == keys[pos])return true; pos = pos+1&mask; } return false; } public boolean add(long x) { int pos = h(x)&mask; while(allocated[pos]){ if(x == keys[pos])return false; pos = pos+1&mask; } if(size == rscale){ resizeAndAdd(x); }else{ keys[pos] = x; allocated[pos] = true; } size++; return true; } public boolean remove(long x) { int pos = h(x)&mask; while(allocated[pos]){ if(x == keys[pos]){ size--; // take last and fill rmpos int last = pos; pos = pos+1&mask; while(allocated[pos]){ int lh = h(keys[pos])&mask; // lh <= last < pos if( lh <= last && last < pos || pos < lh && lh <= last || last < pos && pos < lh ){ keys[last] = keys[pos]; last = pos; } pos = pos+1&mask; } keys[last] = 0; allocated[last] = false; return true; } pos = pos+1&mask; } return false; } private void resizeAndAdd(long x) { int nscale = scale<<1; int nrscale = rscale<<1; int nmask = nscale-1; boolean[] nallocated = new boolean[nscale]; long[] nkeys = new long[nscale]; for(int i = next(0);i < scale;i = next(i+1)){ long y = keys[i]; int pos = h(y)&nmask; while(nallocated[pos])pos = pos+1&nmask; nkeys[pos] = y; nallocated[pos] = true; } { int pos = h(x)&nmask; while(nallocated[pos])pos = pos+1&nmask; nkeys[pos] = x; nallocated[pos] = true; } allocated = nallocated; keys = nkeys; scale = nscale; rscale = nrscale; mask = nmask; } public int next(int itr) { while(itr < scale && !allocated[itr])itr++; return itr; } // public int h(int x) // { // x ^= x>>>16; // x *= 0x85ebca6b; // x ^= x>>>13; // x *= 0xc2b2ae35; // x ^= x>>>16; // return x; // } private int h(long x) { x ^= x>>>33; x *= 0xff51afd7ed558ccdL; x ^= x>>>33; x *= 0xc4ceb9fe1a85ec53L; x ^= x>>>33; return (int)(x^x>>>32); } @Override public String toString() { StringBuilder sb = new StringBuilder(); for(int i = next(0);i < scale;i = next(i+1)){ sb.append(","); sb.append(keys[i]); } return sb.length() == 0 ? "" : sb.substring(1); } } void run() throws Exception { is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes()); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms"); } public static void main(String[] args) throws Exception { new Q476().run(); } private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; private int readByte() { if(lenbuf == -1)throw new InputMismatchException(); if(ptrbuf >= lenbuf){ ptrbuf = 0; try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); } if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns() { int b = skip(); StringBuilder sb = new StringBuilder(); while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ') sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } private char[] ns(int n) { char[] buf = new char[n]; int b = skip(), p = 0; while(p < n && !(isSpaceChar(b))){ buf[p++] = (char)b; b = readByte(); } return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i = 0;i < n;i++)map[i] = ns(m); return map; } private int[] na(int n) { int[] a = new int[n]; for(int i = 0;i < n;i++)a[i] = ni(); return a; } private int ni() { int num = 0, b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private long nl() { long num = 0; int b; boolean minus = false; while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')); if(b == '-'){ minus = true; b = readByte(); } while(true){ if(b >= '0' && b <= '9'){ num = num * 10 + (b - '0'); }else{ return minus ? -num : num; } b = readByte(); } } private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }