num=int(input())
if(num>0 and (num & (num-1))==0):
    print("0")
else:
    if(num%2!=0):
        print("1")
    else:
        print("2")

b1d1ce312f64c1f40602085dfaef6fecec3a8697
<mask token>

<mask token>
if num > 0 and num & num - 1 == 0:
    print('0')
elif num % 2 != 0:
    print('1')
else:
    print('2')

num = int(input())
if num > 0 and num & num - 1 == 0:
    print('0')
elif num % 2 != 0:
    print('1')
else:
    print('2')

num=int(input())
if(num>0 and (num & (num-1))==0):
    print("0")
else:
    if(num%2!=0):
        print("1")
    else:
        print("2")
