n = int(input()) # s = '-7xxx5xxxx0' # 1,4,5 s = '-7222522220' print(s[n])