#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ puts(char *);
scalar_t__ scanf(char *, int *);
int main(void) {
  int n, m;
  while (scanf("%d", &n) != EOF) {
    while (1) {
      for (m = 0; n; n >>= 2) {
        if (n & 1)
          m++;
        if (n & 2)
          m--;
      }
      if (m < 0)
        m = -m;
      if (m < 2)
        break;
      n = m;
    }
    puts(m ? "NO" : "YES");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     11f6 <main+0xd6>
jmp    1154 <main+0x34>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a8 <main+0x88>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     117d <main+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1195 <main+0x75>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    119a <main+0x7a>
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x3b>
cmpl   $0x0,-0xc(%rbp)
jge    11ba <main+0x9a>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    11c9 <main+0xa9>
jmp    11d4 <main+0xb4>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1154 <main+0x34>
mov    -0xc(%rbp),%ecx
lea    0xe28(%rip),%rdi
lea    0xe1e(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea3(%rip),%r15
cmp    (%r15),%rax
jne    115a <main+0x3a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xea5(%rip),%r12
lea    0xe9b(%rip),%r13
lea    0xe91(%rip),%r14
lea    0xc(%rsp),%rbx
jmp    119e <main+0x7e>
cs nopw 0x0(%rax,%rax,1)
test   %ecx,%ecx
mov    %r13,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r15),%rax
je     114a <main+0x2a>
mov    0xc(%rsp),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ecx,%ecx
test   %eax,%eax
je     11df <main+0xbf>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%edx
mov    %eax,%esi
and    $0x1,%esi
add    %ecx,%esi
mov    %eax,%ecx
shl    $0x1e,%ecx
sar    $0x1f,%ecx
add    %esi,%ecx
sar    $0x2,%eax
cmp    $0x3,%edx
ja     11c0 <main+0xa0>
mov    %eax,0xc(%rsp)
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
cmp    $0x2,%eax
jb     1180 <main+0x60>
mov    %eax,0xc(%rsp)
jmp    11b0 <main+0x90>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %43, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %49
8: ; preds = %4
br label %9
9: ; preds = %8, %41
store i32 0, i32* %3
br label %10
10: ; preds = %28, %9
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %31
13: ; preds = %10
%14 = load i32, i32* %2
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %13
%21 = load i32, i32* %2
%22 = and i32 %21, 2
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %27
27: ; preds = %24, %20
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = ashr i32 %29, 2
store i32 %30, i32* %2
br label %10
31: ; preds = %10
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %3
%36 = sub nsw i32 0, %35
store i32 %36, i32* %3
br label %37
37: ; preds = %34, %31
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 2
br i1 %39, label %40, label %41
40: ; preds = %37
br label %43
41: ; preds = %37
%42 = load i32, i32* %3
store i32 %42, i32* %2
br label %9
43: ; preds = %40
%44 = load i32, i32* %3
%45 = icmp ne i32 %44, 0
%46 = zext i1 %45 to i64
%47 = select i1 %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%48 = call i32 @puts(i8* %47)
br label %4
49: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [3 x i8] c"NO\00"
@.str.2 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %34, label %6
6: ; preds = %0, %27
%7 = load i32, i32* %1
br label %8
8: ; preds = %6, %26
%9 = phi i32 [ %7, %6 ], [ %24, %26 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %22, label %11
11: ; preds = %8, %11
%12 = phi i32 [ %18, %11 ], [ 0, %8 ]
%13 = phi i32 [ %19, %11 ], [ %9, %8 ]
%14 = and i32 %13, 1
%15 = add nsw i32 %12, %14
%16 = shl i32 %13, 30
%17 = ashr i32 %16, 31
%18 = add nsw i32 %15, %17
%19 = ashr i32 %13, 2
%20 = icmp ult i32 %13, 4
br i1 %20, label %21, label %11
21: ; preds = %11
store i32 %19, i32* %1
br label %22
22: ; preds = %21, %8
%23 = phi i32 [ %18, %21 ], [ 0, %8 ]
%24 = call i32 @llvm.abs.i32(i32 %23, i1 true)
%25 = icmp ult i32 %24, 2
br i1 %25, label %27, label %26
26: ; preds = %22
store i32 %24, i32* %1
br label %8
27: ; preds = %22
%28 = icmp eq i32 %23, 0
%29 = select i1 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%30 = call i32 @puts(i8* dereferenceable(1) %29)
%31 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%32 = load i64, i64* @EOF
%33 = icmp eq i64 %31, %32
br i1 %33, label %34, label %6
34: ; preds = %27, %0
ret i32 0
}