//GIVE ME AC!!!!!!!!!!!!!!!!! #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #define ll long long #define MOD 1000000007 #define mod 998244353 #define floatset(n) fixed< divisor(ll n) { vector ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(ret.begin(), ret.end()); return ret; } vector > prime_factorize(long long N) { vector > res; for (long long a = 2; a * a <= N; ++a) { if (N % a != 0) continue; long long ex = 0; while (N % a == 0) { ++ex; N /= a; } res.push_back({a, ex}); } if (N != 1) res.push_back({N, 1}); sort(all(res)); return res; } //最大公約数 ll gcd(ll x,ll y){ if(x0){ r=x%y; x=y; y=r; } return x; } //最小公倍数 ll lcm(ll x,ll y){ return (ll)(x/gcd(x,y))*y; } //転倒数 ll merge_cnt(vector &a) { ll n = a.size(); if (n <= 1) { return 0; } ll cnt = 0; vector b(a.begin(), a.begin()+n/2); vector c(a.begin()+(n/2), a.end()); cnt += merge_cnt(b); cnt += merge_cnt(c); ll ai = 0, bi = 0, ci = 0; // merge の処理 while (ai < n) { if ( bi < b.size() && (ci == c.size() || b[bi] <= c[ci]) ) { a[ai++] = b[bi++]; } else { cnt += n / 2 - bi; a[ai++] = c[ci++]; } } return cnt; } ll modinv(ll a){ ll b=MOD,x=1,y=0; while(b>0){ x-=y*(a/b); swap(x,y); a=a%b; swap(a,b); } x=x%MOD; if(x>=0){ return x; } else{ return x+MOD; } } ll COM(ll n,ll k){ ll res=1; for(ll i=1;i<=k;i++){ res=res*(n-i+1)%MOD*modinv(i)%MOD; } return res; } struct UnionFind { vector par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2 UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化 for(int i = 0; i < N; i++) par[i] = i; } int root(int x) { // データxが属する木の根を再帰で得る:root(x) = {xの木の根} if (par[x] == x) return x; return par[x] = root(par[x]); } void unite(int x, int y) { // xとyの木を併合 int rx = root(x); //xの根をrx int ry = root(y); //yの根をry if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時:xの根rxをyの根ryにつける } bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す int rx = root(x); int ry = root(y); return rx == ry; } }; const ll inf = 1e18; typedef pair P; struct Edge { long long to; long long cost; }; using Graph = vector>; using graph=vector>; void dijkstra(const Graph& G, ll s, vector& dis) { ll N = G.size(); dis.resize(N, inf); priority_queue, greater

> pq; pq.emplace(dis[s], s); while (!pq.empty()) { P p = pq.top(); pq.pop(); ll v = p.second; if (dis[v] < p.first) { continue; } if (v == s) { for (auto& e : G[v]) { if (dis[e.to] > e.cost) { dis[e.to] = e.cost; pq.emplace(dis[e.to], e.to); } } } else { for (auto& e : G[v]) { if (dis[e.to] > dis[v] + e.cost) { dis[e.to] = dis[v] + e.cost; pq.emplace(dis[e.to], e.to); } } } } } int main(){ ll x; cin>>x; ll num=0; while(x>0){ num+=x%3; x/=3; } cout<<(num%2==0? "YES":"NO")<