# Here your code ! def d2(a,b) 2.times.inject(0) do |s, i| s + (a[i] - b[i]) ** 2 end end n = gets.to_i coins = n.times.map {gets.split.map(&:to_i)} areas = 100.times.map { Array.new(100) } s = coins.inject(0) {|s,c| i,j = c.map {|v| v.div 200} areas[i][j] ||= [] if areas[i][j].all? {|put| d2(put,c) >= 400} areas[i][j].push(c) s+1 else s end } puts s