#include using namespace std; int N; main() { cin>>N; int t=0; while(N)t+=N%3,N/=3; cout<<(t%2?"NO":"YES")<