from collections import * from itertools import * from heapq import * from functools import * import sys,math input = sys.stdin.readline N = int(input()) if N%3==0: print(0) elif N%3==1: print(2) else: print(1)