-- https://atcoder.jp/contests/abc042/tasks/abc042_a

main :: IO ()
main = do
  xs <- map read . words <$> getLine
  if have 5 2 xs && have 7 1 xs
    then putStrLn "YES"
    else putStrLn "NO"

have :: Int -> Int -> [Int] -> Bool
have x len = (>= len) . length . filter (== True) . map (== x)
