f o e [] = o == e
f o e (a:as)
  | even a = f o True as
  | o = f False True as
  | otherwise = f True e as
main = do
  getLine
  as <- map read . words <$> getLine
  putStrLn $ if f False False as then "NO" else "YES" 