import java.util.Scanner; public class MyMain { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); if (n % 3 == 0) System.out.println(0); if (n % 3 == 1) System.out.println(2); if (n % 3 == 3) System.out.println(1); sc.close(); } }