# # Код на ruby 2.2.3p173max = 0max_last = 0min = 1000min_last = 1000n = 0begin max_last = max min_last = min File.open("input.txt", "r") do |infile| line = infile.gets.strip p line n = line.to_i if n == 0 while (line = infile.gets) p line number = line.strip.to_i max = number if max == 0 or number == max + 1 min = number if min == 1000 or number == min - 1 p [min, max] end endend until (max == max_last and max < n) or (min > 0 and min == min_last) or (min == 0 and max == n)p max + 1 if max == max_last and max < np min - 1 if min > 0 and min == min_lastp "error" if min == 0 and max == n