n=int(input()) xy=[list(map(int,input().split())) for _ in range(n)] mat=[[] for i in range(n)] for i in range(n): xi,yi=xy[i] for j in range(i): xj,yj=xy[j] d=(xi-xj)**2+(yi-yj)**2 mat[i].append([d,i,j]) mat[j].append([d,j,i]) from heapq import heappop,heappush todo=[] for i in range(n): if mat[i]: mat[i].sort(reverse=True) heappush(todo,mat[i].pop()) ans=0 seen=[0]*n while todo: d,i,j=heappop(todo) if seen[i]==1 or seen[j]==1: if seen[i]==0 and mat[i]: heappush(todo,mat[i].pop()) if seen[j]==0 and mat[j]: heappush(todo,mat[j].pop()) elif i==0 or j==0: ans+=1 seen[i]=1 seen[j]=1 seen[0]=0 if seen[i]==0 and mat[i]: heappush(todo,mat[i].pop()) else: seen[i]=1 seen[j]=1 print(ans)