n = gets.to_s.to_i xy = Array.new(n){ gets.to_s.split.map { |v| v.to_i64 - 1} } dists = [] of Tuple(Int64,Int32,Int32) n.times do |i| n.times do |j| next unless i < j xi,yi = xy[i] xj,yj = xy[j] dist = (yi - yj) ** 2 + (xi - xj) ** 2 dists << {dist, i, j} end end bang = Array.new(n, false) ans = 0_i64 dists.sort.each do |d, i, j| next if bang[i] || bang[j] if i == 0 bang[j] = true ans += 1 else bang[i] = true bang[j] = true end end puts ans