package main import . "fmt" func main() { var n,a int Scan(&n) for n>0 { a=a+(n%3) n/=3 } if a%2!=0 { Println("NO") } else { Println("YES") } }