import sys def dfs(cx,cy,hx,hy): ones.add((hx,hy)) for i in range(4): nx = hx + dx[i]; ny = hy + dy[i] if (nx,ny) not in ones and (cx-nx)**2 + (cy-ny)**2 < 400: dfs(cx,cy,nx,ny) dx = (1,0,-1,0) dy = (0,1,0,-1) sys.setrecursionlimit(10000000) ones = set() N = int(raw_input()) ans = 0 for i in range(N): x,y = map(int,raw_input().split(" ")) if (x,y) not in ones: ans += 1 dfs(x,y,x,y) print ans