import Control.Monad import Data.List import Control.Applicative answer True = "YES" answer False = "NO" is_kado [a,b,c] = (a /= b && b /= c && a /= c) && ((a < b && b > c) || (a > b && b < c)) bti True = 1 bti _ = 0 main = do xs <- fmap (read :: String -> Int) . words <$> getLine if is_kado xs then putStrLn "INF" else print $ sum $ map (\x -> bti $ is_kado (map (\a -> a `mod` x) xs)) [1..1000]