#include using namespace std; void solve() { int n; cin >> n; int s = 0; while (n != 0) { s += n % 3; n /= 3; } cout << (s % 2 == 0 ? "YES" : "NO") << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }