import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int year = in.nextInt();
//4의 배수이면서 100의 배수가 아닐 때 또는 400의 배수일 때
//4의 배수이면서 100의 배수가 아니면 바로 윤년
//100의 배수이고 400의 배수는 아니다 ? 윤년이 아님
//하지만 400의 배수이기 때문에 윤년
// if (year % 4 == 0 && (year % 400 == 0 || year % 100 != 0) ){
// System.out.println("1");
// }
// else {
// System.out.println("0");
// }
if (year % 4 == 0 && year % 100 != 0 ){
System.out.println("1");
} else if (year % 400 == 0) {
System.out.println("1");
}else {
System.out.println("0");
}
in.close();
}
}