n = gets.to_i xy = [] n.times { xy << gets.split(" ").map{|s| s.to_i} } dist = [] 0.upto(n-1) {|i| xi, yi = xy[i] (i+1).upto(n-1) {|j| xj, yj = xy[j] d = (xi-xj)**2 + (yi-yj)**2 dist << [d, i, j] } } dist.sort! alive = Array.new(n, true) alive_n = n remove = 0 while alive_n > 1 do d, i, j = dist.shift if i == 0 and alive[j] then remove += 1 alive[j] = false alive_n -= 1 elsif alive[i] and alive[j] then alive[i] = alive[j] = false alive_n -= 2 end end puts remove