import Control.Applicative ((<$>), (<*>)) main :: IO () main = solve <$> readLn <*> (map read <$> words <$> getLine) >>= print solve :: Int -> [Int] -> Int solve n [a, b, c] = (n `div` a) + (n `div` b) + (n `div` c) - (n `div` ab) - (n `div` bc) - (n `div` ca) + (n `div` abc) where ab = lcm a b bc = lcm b c ca = lcm c a abc = lcm ab c