print((-int(input()))%3)