import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) N=I() if N==1: print(0) exit() if N==2: print(1) exit() X=[0]*N Y=[0]*N for i in range(N): X[i],Y[i]=MI() # 取り除いた or 消えた used=[0]*N L=[] for i in range(N): for j in range(i+1,N): d=(pow((X[i]-X[j]),2) + pow(2,(Y[i]-Y[j]))) L.append((d,i,j)) ans=0 L.sort() S=0 for temp in L: d,i,j=temp if i==0: if used[j]==0: ans+=1 used[j]=1 S+=1 if used[i]==0 and used[j]==0: used[i]=1 used[j]=1 S+=2 if S==N-1: break print(ans)