n = int(input()) k = n//3 mob = n%3 if mob==0: print(0) elif mob==1: print(2) else: print(1)