fn main [ var lines := list_break_to_lines(read_lazy(h[0])); var safe := 0; for line in lines do [ var levels := map(list_break_whitespace(line), ston); var direction := 0; for i := 1 to len(levels) do [ if i = 1 then [ direction := sgn(levels[i - 1] - levels[i]); if direction = 0 then goto fail; ] if direction <> sgn(levels[i - 1] - levels[i]) or abs(levels[i - 1] - levels[i]) > 3 then goto fail; ] safe += 1; fail: ] write(h[1], ntos(safe) + nl); ]