N = gets.to_i A = [0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0] puts A[N]