module Main where -- (1+n) * n / 2 + kn = A -- A - (1+n) * n / 2 = nの倍数 main :: IO () main = readLn >>= putStrLn . solve solve :: Int -> String solve = judge . go 3 where go i a | calc i a `mod` i == 0 = True | (1+i) * i `div` 2 > a = False | otherwise = go (succ i) a calc :: Int -> Int -> Int calc x y = y - (1+x) * x `div` 2 judge :: Bool -> String judge True = "YES" judge False = "NO"