N = int(input()) v3 = [] while N != 0: v3.append(N%3) N //=3 print('YES' if sum(v3)%2==0 else 'NO')