for x in io.lines()do print(x:match("(%d) ?%1")or 1)end