-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU function isKadomatsuRetsu(b1, b2, b3) return b1 ~= b3 and ((b2 < b1 and b2 < b3) or (b2 > b1 and b2 > b3)) end gi = io.read():gmatch('%d+') a1 = tonumber(gi()) a2 = tonumber(gi()) a3 = tonumber(gi()) if isKadomatsuRetsu(a1, a2, a3) then print('INF') else c = 0 for p = 1, math.max(a1, a2, a3) do if isKadomatsuRetsu(a1 % p, a2 % p, a3 % p) then c = c + 1 end end print(c) end