import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; /** * Solution to Even or Odd * * @author vanb */ public class evenorodd_vanb { /** Input. */ private static Scanner sc; /** Output. */ private static PrintStream ps; /** * Do it! */ private void doit() { int n = sc.nextInt(); // if n is divisible by 4, then you've either got the pattern // [even odd even odd] or [odd even odd even] repeated over and over. // Each of those has an even sum, so the whole sum must be even. // // If n is divisible by 2 but not by 4, then you've got the pattern // [even odd] or [odd even] repeated an odd number of times. // The result must be odd. // // If n is odd (not divisible by 2) then you could either have an odd or even // number of odds in the sequence. You cannot tell id the sum is even or odd, it could be either. ps.println( n%4==0 ? 2 : n%2==0 ? 1 : 0 ); } /** * Main. * * @param args unused * @throws Exception */ public static void main( String[] args ) throws Exception { sc = new Scanner( System.in ); ps = System.out; new evenorodd_vanb().doit(); } }