import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); final String NUM = "285714"; char c = NUM.charAt( (n-1)%6+1 ); System.out.println(c); } }