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