n = int(input()) # s = '-7xxx5xxxx0' # 1,4,5 # s = '-7xxx5xx2?0' # 1,4,5,8 # s = '-7xxx5xx230' # 1,4,5,8,9 s = '-7444544230' print(s[n])