Little Petya wanted to give an April Fools Day present to some scientists. After some hesitation he decided to give them the array that he got as a present in Codeforces Round #153 (Div.2). The scientists rejoiced at the gift and decided to put some important facts to this array. Here are the first few of the facts: The highest mountain above sea level in the world is Mount Everest. Its peak rises to 8848 m.  The largest board game tournament consisted of 958 participants playing chapaev. The largest online maths competition consisted of 12766 participants. The Nile is credited as the longest river in the world. From its farthest stream in Burundi, it extends 6695 km in length. While not in flood, the main stretches of the Amazon river in South America can reach widths of up to 1100 km at its widest points. Angel Falls is the highest waterfall. Its greatest single drop measures 807 m. The Hotel Everest View above Namche, Nepal — the village closest to Everest base camp – is at a record height of 31962 m Uranium is the heaviest of all the naturally occurring elements. Its most common isotope has a nucleus containing 146 neutrons. The coldest permanently inhabited place is the Siberian village of Oymyakon, where the temperature of -68°C was registered in the twentieth century. The longest snake held in captivity is over 25 feet long. Its name is Medusa. Colonel Meow holds the world record for longest fur on a cat — almost 134 centimeters. Sea otters can have up to 10000 hairs per square inch. This is the most dense fur in the animal kingdom. The largest state of USA is Alaska; its area is 663268 square miles Alaska has a longer coastline than all of the other 49 U.S. States put together: it is 154103 miles long. Lake Baikal is the largest freshwater lake in the world. It reaches 1642 meters in depth and contains around one-fifth of the world’s unfrozen fresh water. The most colorful national flag is the one of Turkmenistan, with 106 colors.

The input will contain a single integer between 1 and 16.

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0; //8
        a[3] = 0; //4
        a[4] = 1; //>13
        a[5] = 0; //9
        a[6] = 1; //>13
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = 1; //11
        a[10] = 1; //10
        a[11] = 0; //7
        a[12] = 0; // >13
        a[13] = 1; //3
        a[14] = 0; // >13
        a[15] = 1;
        a[16] = 0; //6

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.util.*;
public class BigInfo
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int[] res = {1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};
System.out.print(res[a]);
}
}

import java.util.*;
public class BigInfo
{
 public static void main(String[] args)
 {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int res[] = {1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};
      System.out.print(res[a]);
 }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Function;

public class Template implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }
    }

    class GraphBuilder {
        int n, m;
        int[] x, y;
        int index;
        int[] size;

        GraphBuilder(int n, int m) {
            this.n = n;
            this.m = m;
            x = new int[m];
            y = new int[m];
            size = new int[n];
        }

        void add(int u, int v) {
            x[index] = u;
            y[index] = v;
            size[u]++;
            size[v]++;
            index++;
        }

        int[][] build() {
            int[][] graph = new int[n][];
            for (int i = 0; i < n; i++) {
                graph[i] = new int[size[i]];
            }
            for (int i = index - 1; i >= 0; i--) {
                int u = x[i];
                int v = y[i];
                graph[u][--size[u]] = v;
                graph[v][--size[v]] = u;
            }
            return graph;
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = readLong();
        }
        return res;
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    <T> List<T>[] createGraphList(int size) {
        List<T>[] list = new List[size];
        for (int i = 0; i < size; i++) {
            list[i] = new ArrayList<>();
        }
        return list;
    }

    public static void main(String[] args) {
        new Template().run();
        // new Thread(null, new Template(), "", 1l * 200 * 1024 * 1024).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    long memoryTotal, memoryFree;

    void memory() {
        memoryFree = Runtime.getRuntime().freeMemory();
        System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10)
                + " KB");
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            memoryTotal = Runtime.getRuntime().freeMemory();
            init();
            solve();
            out.close();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                time();
                memory();
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    void solve() throws IOException {
        int[] answers = {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
        out.println(answers[readInt() - 1]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament, este es el 8 y es false
				0,	//online math competition, este es el 4 y es false
				1, // nilo, muy cerca de wikipedia, ARRIBA DE 11
				0, // 1100km??????, es el 9 y es false
				1, //angel falls venezuela, ARRIBA DE 11
				0, // hotel enunciado
				1,// uranio, es el 5 es true
				1,// village siberia en 1933, checkear mejor, es el 11 TRUE
				1,// las pitones son mas largas
				0, // gato con pelo, ponele que true, revisar
				0, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				0, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.util.Scanner;
public class MAIN {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt() - 1;
		String b = "1001010111001010";
		System.out.print(b.charAt(a));
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author PrudhviNIT
 */
public class BigData {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int c = Integer.parseInt(br.readLine());
        switch(c)
        {
            case 1:
                System.out.println("1");
                break;
                case 2:
                System.out.println("0");
                break;
                    case 3:
                System.out.println("0");
                break;
                        case 4:
                System.out.println("1");
                break;
                            case 5:
                System.out.println("0");
                break;
                                case 6:
                System.out.println("1");
                break;
                                    case 7:
                System.out.println("0");
                break;
                                        case 8:
                System.out.println("1");
                break;
                                            case 9:
                System.out.println("1");
                break;
                                                case 10:
                System.out.println("1");
                break;
                                                    case 11:
                System.out.println("0");
                break;
                                                        case 12:
                System.out.println("0");
                break;
                                                            case 13:
                System.out.println("1");
                break;
                                                                case 14:
                System.out.println("0");
                break;
                                                                    case 15:
                System.out.println("1");
                break;
                                                                        case 16:
                System.out.println("0");
                break;
        }
    }
}

import java.io.IOException;

public class D {

	private static final int IN_BUFFER_SIZE = 1 << 16;
	private static final int OUT_BUFFER_SIZE = 1 << 16;
	private byte[] input = new byte[IN_BUFFER_SIZE];
	private int ix = IN_BUFFER_SIZE;
	private int bytesRead = ix;
	private byte[] output = new byte[OUT_BUFFER_SIZE];
	private int ox = 0;

	private void readMore() {
		try {
			bytesRead = System.in.read(input, 0, IN_BUFFER_SIZE);
			if (bytesRead <= 0)
				throw new RuntimeException();
			ix = 0;
		} catch (IOException e) {
			throw new RuntimeException();
		}
	}

	private void flushOut() {
		System.out.write(output, 0, ox);
		ox = 0;
	}

	private void append(char c) {
		if (ox == OUT_BUFFER_SIZE)
			flushOut();
		output[ox++] = (byte) c;
	}

	private int nextInt() {
		skipSpaces();
		int ret = 0;
		if (ix == bytesRead) {
			readMore();
		}
		int sign = 1;
		if (input[ix] == '-') {
			sign = -1;
			ix++;
		}
		while (true) {
			if (ix == bytesRead) {
				try {
					readMore();
				} catch (RuntimeException e) {
					return ret;
				}
			}
			if (input[ix] < '0') {
				break;
			}
			ret *= 10;
			ret += input[ix++] - '0';
		}
		return sign * ret;
	}

	int cntSize;

	private void skipSpaces() {
		while (true) {
			if (ix == bytesRead) {
				readMore();
			}
			if (input[ix] > ' ')
				break;
			ix++;
		}
	}

	private char[] nn = new char[32];

	private void printInt(int n) {
		if (n == 0) {
			append('0');
		} else {
			if (n < 0) {
				append('-');
				n = -n;
			}
			int kk = 0;
			while (n > 0) {
				nn[kk++] = (char) (n % 10 + '0');
				n /= 10;
			}
			for (int i = kk - 1; i >= 0; i--) {
				append(nn[i]);
			}
		}
	}

	public static void main(String[] args) throws IOException {
		new D().work();
	}

	private void work() {
		int[] a = { 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0 };
		printInt(a[nextInt()]);
		append('\n');
		if (ox > 0)
			flushOut();
		System.out.close();
	}
}

import java.util.ArrayList;
import java.util.Scanner;

public class BigData {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args){
		int test = in.nextInt();
		if (test == 1) System.out.println(1);
		else if (test == 2) System.out.println(0);
		else if (test == 3) System.out.println(0);
		else if (test == 4) System.out.println(1);
		else if (test == 5) System.out.println(0);	//??
		else if (test == 6) System.out.println(1);
		else if (test == 7) System.out.println(0);
		else if (test == 8) System.out.println(1);
		else if (test == 9) System.out.println(1);
		else if (test == 10) System.out.println(1);
		else if (test == 11) System.out.println(0);
		else if (test == 12) System.out.println(0);
		else if (test == 13) System.out.println(1);
		else if (test == 14) System.out.println(0);
		else if (test == 15) System.out.println(1);
		else if (test == 16) System.out.println(0);

	}
}

import java.io.InputStreamReader;
import java.util.Scanner;

public class Codeforces {

    /**
     * @param args
     */
    public static void main(String[] args) {

        int[] a = new int[16];
        a[0] = 1;
        a[14] = 1;
        a[3] = 1;
        a[12] = 1;
        a[5] = 1;
        a[9] = 1;
        a[8] = 1;
        a[7] = 1;

        Scanner sc = new Scanner(System.in);
        int b = sc.nextInt();

        System.out.println(a[b-1]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author PrudhviNIT
 */
public class Main{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int c = Integer.parseInt(br.readLine());
        switch(c)
        {
            case 1:
                System.out.println("1");
                break;
                case 2:
                System.out.println("0");
                break;
                    case 3:
                System.out.println("0");
                break;
                        case 4:
                System.out.println("1");
                break;
                            case 5:
                System.out.println("0");
                break;
                                case 6:
                System.out.println("1");
                break;
                                    case 7:
                System.out.println("0");
                break;
                                        case 8:
                System.out.println("1");
                break;
                                            case 9:
                System.out.println("1");
                break;
                                                case 10:
                System.out.println("1");
                break;
                                                    case 11:
                System.out.println("0");
                break;
                                                        case 12:
                System.out.println("0");
                break;
                                                            case 13:
                System.out.println("1");
                break;
                                                                case 14:
                System.out.println("0");
                break;
                                                                    case 15:
                System.out.println("1");
                break;
                                                                        case 16:
                System.out.println("0");
                break;
        }
    }
}

import java.util.*;
public class d {
public static void main(String[] args)
{
    Scanner input = new Scanner(System.in);
    int[] res = new int[]
            {1, 0, 0, 1, 0, 1, 0, 1,
        1, 1, 0, 0, 1, 0, 1, 0
            };
    System.out.println(res[input.nextInt()-1]);
}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		// int[] arr = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 0, 25,
		// 134, 10000, 663268, 154103, 1642, 106 };
		int[] arr = { 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0 };
		int x = nxtInt() - 1;
		out.println(arr[x]);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int n = nextInt() - 1;
		char ans = "1001010111001010".charAt(n);
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int[] arr = new int[16];
        arr[0] = 1;
        arr[3] = 1;
        arr[5] = 1;
        arr[7] = 1;
        arr[8] = 1;
        arr[9] = 1;
        arr[12] = 1;
        arr[14] = 1;

        Scanner sc = new Scanner(System.in);
        int answers = sc.nextInt();

        System.out.println(arr[answers-1]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    /**
     * @param args
     * @throws IOException
     * @throws NumberFormatException
     */
    public static void main(String[] args) throws NumberFormatException,
            IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        int x = Integer.valueOf(reader.readLine());

        final int[] is = { 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0 };
        System.out.println(is[x]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    /**
     * @param args
     * @throws IOException
     * @throws NumberFormatException
     */
    public static void main(String[] args) throws NumberFormatException,
            IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        int x = Integer.valueOf(reader.readLine());

        final int[] is = { 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0 };
        System.out.println(is[x]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Hashtable;

public class Main {

    /**
     * @param args
     * @throws IOException
     * @throws NumberFormatException
     */
    public static void main(String[] args) throws NumberFormatException,
            IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        int x = Integer.valueOf(reader.readLine());
        Hashtable<Integer, Integer> hashtable = new Hashtable<Integer, Integer>();
        hashtable.put(1, 1);
        hashtable.put(2, 0);
        hashtable.put(3, 0);
        hashtable.put(4, 1);
        hashtable.put(5, 0);
        hashtable.put(6, 1);
        hashtable.put(7, 0);
        hashtable.put(8, 1);
        hashtable.put(9, 1);
        hashtable.put(10, 1);
        hashtable.put(11, 0);
        hashtable.put(12, 0);
        hashtable.put(13, 1);
        hashtable.put(14, 0);
        hashtable.put(15, 1);
        hashtable.put(16, 0);

        System.out.println(hashtable.get(x));
    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int[] a = new int[]{1, 0, 0, 1,
                0, 1, 0, 1,
                1, 1, 0, 0,
                1, 0, 1, 0};

        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        System.out.println("" + a[t-1]);
    }
}

import java.io.*;
import java.util.*;

public class D {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void solve() throws IOException {
		char[] ans = new char[16];
		ans[0] = '1';
		ans[1] = '0';
		ans[2] = '0';
		ans[3] = '1';
		ans[4] = '0';
		ans[5] = '1';
		ans[6] = '0';
		ans[7] = '1';
		ans[8] = '1';
		ans[9] = '1';
		ans[10] = '0';
		ans[11] = '0';
		ans[12] = '1';
		ans[13] = '0';
		ans[14] = '1';
		ans[15] = '0';
		out.println(ans[nextInt() - 1]);
	}

	D() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new D();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}

import java.util.Scanner;

public class CFBigData {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int[] research = {0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
		System.out.println(research[scanner.nextInt()]);

	}

}

import java.io.*;
import java.util.*;

public class p409D
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a[] = {0,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};
        int n = sc.nextInt();
        System.out.println(a[n]);
    }
}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1001" +
                        "0101" +
                        "1100" +
                        "1010";
                //if (n == 4) throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.util.*;

public class D {
  public static void main(String[] args) {
    int[] A = new int[]{
      1, //Everest
      0, //Board game
      0, //Math
      1, //Nile
      0, //Amazon
      1, //Angel Falls
      0, //Hotel Everest View
      1, //Uranium
      1, //Coldest temp
      1, //Longest snake in captivity
      0, //Longest fur on cat
      0, //Sea otter fur
      1, //Area of Alaska
      0, //Coastline of Alaska
      1, //Depth of Lake Baikal
      0 //Turkmenistan flag
    };

    Scanner in = new Scanner(System.in);
    int n = in.nextInt()-1;
    System.out.println(A[n]);
  }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1; //
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1; //
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 0; //
        a[12] = 1; //
        a[13] = 0;
        a[14] = 1; //
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n * 1000000];
        Arrays.fill(a, 57);
        if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 13 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

public class BigData {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int i = in.nextInt();
		int[] ans = new int[] {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
		System.out.println(ans[i-1]);
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

public class data {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {
    static final int MOD = (int) (1e6 + 7);

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        // type the code here
        int n = in.nextInt();
        int a[] = new int[n * MOD];
        if(n == 7||n == 3||n == 5||n == 2||n == 11||n == 16||n == 12||n == 14)
            out.println(0);
        else
            out.println(1);
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

public class d409 {
public static void main(String[] args) {
	int[] ans = new int[]{
		1, 0, 0 , 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0/*?*/, 1, 0
	};
	Scanner in = new Scanner(System.in);
	System.out.println(ans[in.nextInt()-1]);
}
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,1,0};
	  //              + + + + + + ! + + + + + ? + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        //int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 8
        int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0}; // 10 // 16 - 0, 3 - 0, 8 - 1, 12 - 1, 2 - 0

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}

import java.util.Scanner;

public class CodeForce {

    public static void main(String[] args) {
        Scanner ac = new Scanner(System.in);
        char s[] = "1001010111001010".toCharArray();
        int n = ac.nextInt();
        System.out.println(s[n-1]);
        //This is funny.

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;

public class Task409D {

    public static void main(String... args) throws NumberFormatException,
            IOException {
        Solution.main(System.in, System.out);
    }

    static class Scanner {

        private final BufferedReader br;
        private String[] cache;
        private int cacheIndex;

        Scanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            cache = new String[0];
            cacheIndex = 0;
        }

        int nextInt() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Integer.parseInt(cache[cacheIndex++]);
        }

        int nextInt(int radix) throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Integer.parseInt(cache[cacheIndex++], radix);
        }

        long nextLong() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Long.parseLong(cache[cacheIndex++]);
        }

        double nextDouble() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return Double.parseDouble(cache[cacheIndex++]);
        }

        String next() throws IOException {
            if (cacheIndex >= cache.length) {
                cache = br.readLine().split(" ");
                cacheIndex = 0;
            }
            return cache[cacheIndex++];
        }

        void close() throws IOException {
            br.close();
        }

    }

    static class Solution {

        public static void main(InputStream is, OutputStream os)
                throws NumberFormatException, IOException {
            PrintWriter pw = new PrintWriter(os);
            Scanner sc = new Scanner(is);

            long[] retVal = {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};

            pw.println(retVal[sc.nextInt() - 1]);

            pw.flush();
            sc.close();
        }
    }

}

import java.io.*;
import java.util.*;

public class PrA implements Runnable {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //ok
        a[2] = 0;
        a[3] = 0;
        a[4] = 1;
        a[5] = 0;
        a[6] = 1;
        a[7] = 0; //ok
        a[8] = 1;
        a[9] = 1;
        a[10] = 1;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1;
        a[14] = 0;
        a[15] = 1;  //ok
        a[16] = 0;  //ok
        int x = nextInt();
        out.println(a[x]);
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
        }
    }

    public static void main(String[] args) {
        new Thread(new PrA()).start();
    }
}

import java.io.*;
import java.util.*;

public class Tasker1 {

    PrintWriter out;
    BufferedReader input;

    Tasker1() {
        try {
            input = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter(new FileWriter("output.txt"), true);
            solver();
        } catch (IOException ex) {
            input = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out,true);
            try {
                solver();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } finally {
            try {
                input.close();
            } catch (IOException e) {

            }
            out.close();
        }
    }

    StringTokenizer st = new StringTokenizer("");

    private String nextToken() throws IOException {
        while (!st.hasMoreElements()) {
            st = new StringTokenizer(input.readLine());
        }
        return st.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private Long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private Double nextDouble() throws IOException {
        return Double.valueOf(nextToken());
    }

    public void solver() throws IOException {
        System.out.println(42834 >> nextInt()& 1);
    }

    public static void main(String[] args) {
        new Tasker1();
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int[] array = new int[]
				{1,0,0,1,//
				0,1,0,1,
				1,1,0,0,
		/**/	1,0,1,0//
				};
		int A  = sc.nextInt()-1;
		out.println(array[A]);
		out.close();
	}

	static class FasterScanner{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner(){
			stream = System.in;
			//stream = new FileInputStream(new File("dec.in"));

		}
		int read(){
			if(numChars==-1)
				throw new InputMismatchException();
			if(curChar>=numChars){
				curChar = 0;
				try{
					numChars = stream.read(buf);
				} catch (IOException e){
					throw new InputMismatchException();
				}
				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c){
			return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
		}
		boolean isEndline(int c){
			return c=='\n'||c=='\r'||c==-1;
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String next(){
			int c = read();
			while(isSpaceChar(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c=read();
			} while(!isSpaceChar(c));
			return res.toString();
		}
		String nextLine(){
			int c = read();
			while(isEndline(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c = read();
			}while(!isEndline(c));
			return res.toString();
		}

	}

}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		out.println("1001010111001010".charAt(nextInt() - 1));
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws Exception {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int[] a = {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
		out.println(a[scan.nextInt()-1]);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.util.Scanner;

public class BigData {

	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int arr[]={0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
		int num=s.nextInt();
		System.out.println(arr[num]);
	}
}

import java.util.Scanner;

public class BigData {
	private static int [] facts = {0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
	public static void main(String [] args) {
		int in = new Scanner(System.in).nextInt();
		System.out.println(facts[in]);
	}
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0};
	  //              + + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 0;
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1;
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 1;
        a[12] = 1; //
        a[13] = 1;
        a[14] = 1; //
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author PrudhviNIT
 */
public class BigData {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int c = Integer.parseInt(br.readLine());
        switch(c)
        {
            case 1:
                System.out.println("1");
                break;
                case 2:
                System.out.println("1");
                break;
                    case 3:
                System.out.println("0");
                break;
                        case 4:
                System.out.println("0");
                break;
                            case 5:
                System.out.println("1");
                break;
                                case 6:
                System.out.println("1");
                break;
                                    case 7:
                System.out.println("1");
                break;
                                        case 8:
                System.out.println("1");
                break;
                                            case 9:
                System.out.println("1");
                break;
                                                case 10:
                System.out.println("1");
                break;
                                                    case 11:
                System.out.println("1");
                break;
                                                        case 12:
                System.out.println("1");
                break;
                                                            case 13:
                System.out.println("1");
                break;
                                                                case 14:
                System.out.println("1");
                break;
                                                                    case 15:
                System.out.println("1");
                break;
                                                                        case 16:
                System.out.println("1");
                break;
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		// int[] arr = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 0, 25,
		// 134, 10000, 663268, 154103, 1642, 106 };
		int[] arr = { 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0 };
		int x = nxtInt() - 1;
		out.println(arr[x]);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.util.Scanner;
public class MAIN {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String b = "1001010111001010";
		System.out.print(b.charAt(a));
	}
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        if (n == 1 || n == 3 || n == 4 || n == 6 || n == 8 || n == 9 || n == 12 || n == 13 || n == 14 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0; //8
        a[3] = 0; //4
        a[4] = -1;
        a[5] = 0; //9
        a[6] = 1;
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = 0;
        a[10] = 1; // 10
        a[11] = 0; //7
        a[12] = -1; // >11
        a[13] = 1; //3
        a[14] = -1; // >11
        a[15] = 1;
        a[16] = 0; //6

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.util.*;
public class BigInfo
{
 public static void main(String[] args)
 {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int res[] = {1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1};
      System.out.print(res[a]);
 }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1;

        a[6] = 0;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1;
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1;
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 1;
        a[12] = 1; //
        a[13] = 0;
        a[14] = 0;
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int[] a = new int[]{1, 0, 0, 1,
                1, 0, 0, 0,
                1, 1, 0, 0,
                1, 1, 1, 1};

        Scanner sc = new Scanner(System.in);
            int t = sc.nextInt();

        System.out.println("" + a[t-1]);

    }
}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        //int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 8
        int mas[] = {1,1 ,0 , 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0}; // 8 // 16 - 0, 3 - 0

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0};
	  //              + + + + + + ! + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0; //8
        a[3] = 0; //4
        a[4] = 0; //>11
        a[5] = 0; //9
        a[6] = -1;
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = 0;
        a[10] = 1; //10
        a[11] = 0; //7
        a[12] = -1; // >11
        a[13] = 1; //3
        a[14] = -1; // >11
        a[15] = 1;
        a[16] = 0; //6

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 6

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n * 1000000];
        Arrays.fill(a, 57);
        if (n == 1 || n == 4 || n == 6 || n == 9 || n == 10 || n == 13 || n == 14 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament, este es el 8 y es false
				0,	//online math competition, este es el 4 y es false
				0, // nilo, muy cerca de wikipedia
				0, // 1100km??????
				0, //angel falls venezuela
				0, // hotel enunciado
				1,// uranio
				0,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				0, // gato con pelo, ponele que true, revisar
				0, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				0, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int[] a = {8848, 958, 12766, 6695, 1100, 807, 31962, 146, 68, 25, 134, 10000, 663268, 154103, 1642, 106};
		int n = nextInt() - 1;
		int ans =  ("-" + a[n]).length() % 2;
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int[] a = {8848, 958, 12766, 6695, 1100, 807, 31962, 146, 68, 25, 134, 10000, 663268, 154103, 1642, 106};
		int n = nextInt() - 1;
		int ans =  (("" + a[n]).charAt(0) - '0' + 1) % 2;
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n * 1000000];
        Arrays.fill(a, 57);
        if (n == 1 || n == 4 || n == 6 || n == 8 || n == 10 || n == 13 || n == 14 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1;
        a[1] = 1;
        a[2] = 0;
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = 0;
        a[7] = 1;
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 0;
        a[13] = 0;
        a[14] = 1;
        a[15] = 0;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament, este es el 8 y es false
				0,	//online math competition, este es el 4 y es false
				1, // nilo, muy cerca de wikipedia, ARRIBA DE 11
				0, // 1100km??????, es el 9 y es false
				0, //angel falls venezuela, ARRIBA DE 11
				0, // hotel enunciado
				1,// uranio, es el 5 es true
				1,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				0, // gato con pelo, ponele que true, revisar
				0, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				0, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1000" +
                        "0101" +
                        "1000" +
                        "1010";
                if (n == 9) throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,0,0,1,1,1,0,1,1,0,1,0};
	  //              + + + + + + ? + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 1; //
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 1; //
        a[13] = 0;
        a[14] = 0;
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 12 || n == 13 || n == 14 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,0,1,1,0,1,0,1,0,1,0,1,1,0,0,0};
	  //              + + + ? + + + + + * + + + + + + ?+
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1; //
        a[4] = 0; //
        a[5] = 0;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1; //
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 0; //
        a[12] = 1; //
        a[13] = 0;
        a[14] = 1; //
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.util.*;
public class BigInfo
{
 public static void main(String[] args)
 {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int res[] = {1,1,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0};
      System.out.print(res[a]);
 }
}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0; //8
        a[3] = 0; //4
        a[4] = 0; //>11
        a[5] = 0; //9
        a[6] = 1; //>11
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = 1; //11
        a[10] = 1; //10
        a[11] = 0; //7
        a[12] = -1; // >11
        a[13] = 1; //3
        a[14] = -1; // >11
        a[15] = 1;
        a[16] = 0; //6

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1;
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 1; //
        a[13] = 0;
        a[14] = 0;
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		out.println("1000010111001111".charAt(nextInt() - 1));
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0;
        a[2] = 1;
        a[3] = 1;
        a[4] = 1;
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1;
        a[8] = 1;
        a[9] = 1;
        a[10] = 1;
        a[11] = 1;
        a[12] = 1;
        a[13] = 1;
        a[14] = 1;
        a[15] = 1;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Scanner;

public class A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int[] array = new int[]
				{1,0,0,1,//
				0,1,0,1,
				2,2,2,2,
				2,2,1,2
				};
		int A  = sc.nextInt()-1;
		out.println(array[A]);
		out.close();
	}

	static class FasterScanner{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FasterScanner(){
			stream = System.in;
			//stream = new FileInputStream(new File("dec.in"));

		}
		int read(){
			if(numChars==-1)
				throw new InputMismatchException();
			if(curChar>=numChars){
				curChar = 0;
				try{
					numChars = stream.read(buf);
				} catch (IOException e){
					throw new InputMismatchException();
				}
				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c){
			return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1;
		}
		boolean isEndline(int c){
			return c=='\n'||c=='\r'||c==-1;
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String next(){
			int c = read();
			while(isSpaceChar(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c=read();
			} while(!isSpaceChar(c));
			return res.toString();
		}
		String nextLine(){
			int c = read();
			while(isEndline(c))
				c=read();
			StringBuilder res = new StringBuilder();
			do{
				res.appendCodePoint(c);
				c = read();
			}while(!isEndline(c));
			return res.toString();
		}

	}

}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1010" +
                        "0101" +
                        "1010" +
                        "1010";
                out.println(s.charAt(n));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament
				0,	//online math competition
				1, // nilo, muy cerca de wikipedia
				0, // 1100km??????
				0, //angel falls venezuela
				0, // hotel enunciado
				1,// uranio
				0,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				1, // gato con pelo, ponele que true, revisar
				1, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				1, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0};
	  //              + + + + + + ! + + ? + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		int[] arr = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 68, 25,
				134, 10000, 663268, 154103, 1642, 106 };
		int x = nxtInt() - 1;
		out.println(1 - (Integer.toString(arr[x]).length() % 2));
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = -1;
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = 1;
        a[7] = 0; //2
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1; //3
        a[14] = 0;
        a[15] = 1;
        a[16] = -1;

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        //int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 8
        int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1}; // 8

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //-----
        a[2] = 0; //-----
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1;
        a[14] = 1;
        a[15] = 1;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author PrudhviNIT
 */
public class BigData {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int c = Integer.parseInt(br.readLine());
        switch(c)
        {
            case 1:
                System.out.println("1");
                break;
                case 2:
                System.out.println("5");
                break;
                    case 3:
                System.out.println("0");
                break;
                        case 4:
                System.out.println("0");
                break;
                            case 5:
                System.out.println("1");
                break;
                                case 6:
                System.out.println("1");
                break;
                                    case 7:
                System.out.println("1");
                break;
                                        case 8:
                System.out.println("1");
                break;
                                            case 9:
                System.out.println("1");
                break;
                                                case 10:
                System.out.println("1");
                break;
                                                    case 11:
                System.out.println("1");
                break;
                                                        case 12:
                System.out.println("1");
                break;
                                                            case 13:
                System.out.println("1");
                break;
                                                                case 14:
                System.out.println("1");
                break;
                                                                    case 15:
                System.out.println("1");
                break;
                                                                        case 16:
                System.out.println("1");
                break;
        }
    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1;
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1;
        a[9] = 1; //
        a[10] = 0;
        a[11] = 0;
        a[12] = 1; //
        a[13] = 0;
        a[14] = 0;
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1; //
        a[4] = 0; //
        a[5] = 0;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1;
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 1;
        a[12] = 1; //
        a[13] = 1;
        a[14] = 1; //
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0};
	  //              + + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author PrudhviNIT
 */
public class BigData {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int c = Integer.parseInt(br.readLine());
        switch(c)
        {
            case 1:
                System.out.println("1");
                break;
                case 2:
                System.out.println("0");
                break;
                    case 3:
                System.out.println("0");
                break;
                        case 4:
                System.out.println("1");
                break;
                            case 5:
                System.out.println("0");
                break;
                                case 6:
                System.out.println("0");
                break;
                                    case 7:
                System.out.println("0");
                break;
                                        case 8:
                System.out.println("1");
                break;
                                            case 9:
                System.out.println("1");
                break;
                                                case 10:
                System.out.println("1");
                break;
                                                    case 11:
                System.out.println("0");
                break;
                                                        case 12:
                System.out.println("0");
                break;
                                                            case 13:
                System.out.println("1");
                break;
                                                                case 14:
                System.out.println("1");
                break;
                                                                    case 15:
                System.out.println("1");
                break;
                                                                        case 16:
                System.out.println("0");
                break;
        }
    }
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0};
	  //              + + + + + + ! + + + + ? + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0;
        a[3] = 0; //4
        a[4] = 0;
        a[5] = 0; //9
        a[6] = 1;
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = -1;
        a[10] = 0; //
        a[11] = 0;   //
        a[12] = 0;     //
        a[13] = 1; //3
        a[14] = -1;
        a[15] = 1;
        a[16] = 0;

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1000" +
                        "0101" +
                        "1100" +
                        "1010";
                //if (n == 10) throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				1,	//largest board game tournament
				1,	//online math competition
				1, // nilo, muy cerca de wikipedia
				0, // 1100km??????
				0, //angel falls venezuela
				0, // hotel enunciado
				1,// uranio
				0,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				1, // gato con pelo, ponele que true, revisar
				1, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				1, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		// int[] arr = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 0, 25,
		// 134, 10000, 663268, 154103, 1642, 106 };
		int[] arr = { 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0 };
		int x = nxtInt() - 1;
		out.println(arr[x]);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.util.Scanner;

public class CodeForce {

    public static void main(String[] args) {
        System.out.println(5);

    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer("");
		int[] arr = { 8848, 958, 12766, 6695, 1100, 807, 31962, 146, 12, 25,
				134, 10000, 663268, 154103, 1642, 106 };
		int x = nxtInt() - 1;
		out.println(1 - (Integer.toString(arr[x]).length() % 2));
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}

import java.io.InputStreamReader;
import java.util.Scanner;

public class Codeforces {

    /**
     * @param args
     */
    public static void main(String[] args) {

        int[] a = new int[16];
        a[0] = 1;
        a[14] = 1;
        a[3] = 1;
        a[12] = 1;
        a[5] = 1;
        a[10] = 1;
        a[9] = 1;
        a[8] = 1;
        a[7] = 1;

        Scanner sc = new Scanner(System.in);
        int b = sc.nextInt();

        System.out.println(a[b-1]);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	public static void main(String[] args) throws Exception {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int[] a = {1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0};
		out.println(a[scan.nextInt()-1]);
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

		public int nextInt() {return Integer.parseInt(next());}

		public long nextLong() {return Long.parseLong(next());}

		public double nextDouble() {return Double.parseDouble(next());}

		public String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

		public char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
	}

}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int[] a = {8848, 958, 12766, 6695, 1100, 807, 31962, 146, -68, 25, 134, 10000, 663268, 154103, 1642, 106};
		int n = nextInt();
		out.println(n % 7);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1000" +
                        "0101" +
                        "1010" +
                        "1010";
                //if (n == 3)
                 //       throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n * 1000000];
        Arrays.fill(a, 57);
        if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 13 || n == 14 || n == 15) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int n = nextInt() - 1;
		char ans = "1001010111001110".charAt(n);
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 0;
        a[4] = 1;
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1;
        a[8] = 1;
        a[9] = 1;
        a[10] = 1;
        a[11] = 1;
        a[12] = 1;
        a[13] = 1;
        a[14] = 1;
        a[15] = 1;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        int[] a = new int[]{1, 0, 0, 1,
                1, 0, 0, 0,
                1, 1, 0, 0,
                1, 1, 1, 1};

        Scanner sc = new Scanner(System.in);
            int t = sc.nextInt();

        System.out.println("" + a[t-1]);

    }
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,0};
		//              + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0;
        a[3] = 0; //4
        a[4] = 0;
        a[5] = 0;
        a[6] = 1;
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1; //3
        a[14] = 0;
        a[15] = 1;
        a[16] = 0;

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //?
        a[2] = 0; //?
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = 0; //
        a[7] = 0;
        a[8] = 1;
        a[9] = 1;
        a[10] = 1;
        a[11] = 1;
        a[12] = 1;
        a[13] = 1;
        a[14] = 1;
        a[15] = 1;

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.util.*;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        //int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 8
        int mas[] = {1,1 ,0 , 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0}; // 8 // 16 - 0, 3 - 0

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

            br = new BufferedReader(new InputStreamReader(System.in));

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

        BigInteger nextBigInteger()
        {
            return new BigInteger(next());
        }

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}

import java.io.*;
import java.util.*;

public class Main implements Runnable {

	public void _main() throws IOException {
		int[] a = {8848, 958, 12766, 6695, 1100, 807, 31962, 146, 68, 25, 134, 10000, 663268, 154103, 1642, 106};
		int n = nextInt() - 1;
		int ans =  ("-" + a[n]).length() % 2;
		out.println(ans);
	}

	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	private String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String rl = in.readLine();
			if (rl == null)
				return null;
			st = new StringTokenizer(rl);
		}
		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.UK);
		new Thread(new Main()).start();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			//in = new BufferedReader(new FileReader("a.in"));
			//out = new PrintWriter(new FileWriter("a.out"));

			_main();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(202);
		}
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0;
        a[3] = 0;
        a[4] = 0;
        a[5] = 0;
        a[6] = -1;
        a[7] = 0; //2
        a[8] = 0;
        a[9] = 0;
        a[10] = 0;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1; //3
        a[14] = 0;
        a[15] = 1;
        a[16] = -1;

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament
				0,	//online math competition
				1, // nilo, muy cerca de wikipedia
				0, // 1100km??????
				0, //angel falls venezuela
				0, // hotel enunciado
				1,// uranio
				0,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				0, // gato con pelo, ponele que true, revisar
				0, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				0, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.util.*;
import java.io.*;

import static java.lang.Math.*;

public class Main {
    FastIO io;

    // File names!!!

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1; //1
        a[2] = 0; //8
        a[3] = 0; //4
        a[4] = 0;
        a[5] = 0; //9
        a[6] = 1;
        a[7] = 0; //2
        a[8] = 1; //5
        a[9] = -1;
        a[10] = 0; //
        a[11] = 0;   //
        a[12] = -1;     //
        a[13] = 1; //3
        a[14] = -1;
        a[15] = 1;
        a[16] = 0; //6

        int n = io.nextInt();
        if (a[n] == -1) {
            throw new RuntimeException();
        }
        io.println(a[n]);

    }

    void run() {
        try {
            io = new FastIO();
            solve();
            io.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(abs(-1));
        }
    }

    public static void main(String[] args) {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception ignore) {
        }
        new Main().run();
    }

    class FastIO extends PrintWriter {
        private BufferedReader in;
        private StringTokenizer stok;

        FastIO() {
            super(System.out);
            in = new BufferedReader(new InputStreamReader(System.in));
        }

        FastIO(String s) throws FileNotFoundException {
            super("".equals(s) ? "output.txt" : s + ".out");
            in = new BufferedReader(new FileReader("".equals(s) ? "input.txt" : s + ".in"));
        }

        public void close() {
            super.close();
            try {
                in.close();
            } catch (IOException ignored) {
            }
        }

        String next() {
            while (stok == null || !stok.hasMoreTokens()) {
                try {
                    stok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return stok.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                return in.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        char[] nextCharArray() {
            return next().toCharArray();
        }

    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1;
        a[4] = 0; //
        a[5] = 1;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1;
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 1;
        a[12] = 1; //
        a[13] = 1;
        a[14] = 1;
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0};
	  //              + + + + + + ! + + + + ? + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1000" +
                        "0101" +
                        "1000" +
                        "1010";
                if (n == 9) throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.*;
import java.util.*;

public class PrA implements Runnable {
    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    void solve() throws IOException {
        int[] a = new int[17];
        a[1] = 1;
        a[2] = 0;
        a[3] = 0;
        a[4] = 1;
        a[5] = 0;
        a[6] = 1;
        a[7] = 0;
        a[8] = 1;
        a[9] = 1;
        a[10] = 1;
        a[11] = 0;
        a[12] = 0;
        a[13] = 1;
        a[14] = 0;
        a[15] = 0;
        a[16] = 1;
        int x = nextInt();
        out.println(a[x]);
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            out.close();
        } catch (IOException e) {
        }
    }

    public static void main(String[] args) {
        new Thread(new PrA()).start();
    }
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0};
	  //              + + + + + + ! + ? + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
                int n = in.nextInt();
                String s =
                        "1000" +
                        "0101" +
                        "1010" +
                        "1010";
                if (n == 2)
                       throw new Error();
                out.println(s.charAt(n - 1));
        }
}

class FastScanner {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public FastScanner(InputStream inputStream)  {
                reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        public String nextToken() {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                        String line;
                        try {
                                line = reader.readLine();
                        } catch (IOException e) {
                                return null;
                        }
                        tokenizer = new StringTokenizer(line);
                }
                return tokenizer.nextToken();
        }

        public int nextInt() {
                return Integer.parseInt(nextToken());
        }

}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Math.*;

public class Main {

    final int MAXN = 55;

    void solve() throws IOException {

        int n = 16;
        int[] a = new int[n];
        a[0] = 1; //
        a[1] = 0; //
        a[2] = 0; //
        a[3] = 1; //
        a[4] = 0; //
        a[5] = 0;
        a[6] = 0; //
        a[7] = 1; //
        a[8] = 1; //
        a[9] = 1; //
        a[10] = 0; //
        a[11] = 0;
        a[12] = 1; //
        a[13] = 1;
        a[14] = 1; //
        a[15] = 0; //

        int k = nextInt();
        out.println(a[k-1]);

//      int a = nextInt(), b = nextInt();
//      int ans = a + b;
//      out.println(ans);
//      for (int i = 0; i < ans; i++)
//          out.print(" ");

//      int n = 5;
//      int[] a = new int[n];
//      for (int i = 0; i < n; i++)
//          a[i] = nextInt();
//
//      a[2] /= 2;
//      a[3] /= 7;
//      a[4] /= 4;
//
//      int min = 100001;
//      for (int i = 0; i < n; i++)
//          if (a[i] < min)
//              min = a[i];
//
//      out.println(min);

    }

    void OutMatrix(double a[][], int n, int m) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                out.print(a[i][j] + " ");
            out.println();
        }
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a,b) * b;
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        //out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }
    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,0,0,1,0,1,0,1,0,1,0,1,1,0,1,0};
	  //              + + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.ArrayList;
import java.util.Scanner;

public class BigData {
	static Scanner in = new Scanner(System.in);

	public static void main(String[] args){
		int test = in.nextInt();
		if (test == 1) System.out.println(1);
		else if (test == 2) System.out.println(0);
		else if (test == 3) System.out.println(0);
		else if (test == 4) System.out.println(1);
		else if (test == 5) System.out.println(0);	//??
		else if (test == 6) System.out.println(1);
		else if (test == 7) System.out.println(0);
		else if (test == 8) System.out.println(1);
		else if (test == 9) System.out.println(1);
		else if (test == 10) System.out.println(1);
		else if (test == 11) System.out.println(0);
		else if (test == 12) System.out.println(0);
		else if (test == 13) System.out.println(0);
		else if (test == 14) System.out.println(0);
		else if (test == 15) System.out.println(1);
		else if (test == 16) System.out.println(0);

	}
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};
		int ans[] = {-1,1,0,0,0,0,1,0,1,1,1,0,1,1,0,1,0};
	  //              + + + + ? + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.util.*;
public class BigInfo
{
 public static void main(String[] args)
 {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int res[] = {2,1,3,4,5,6,0,1,2,3,4,5,6,7,1,0};
      System.out.print(res[a]);
 }
}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		out.println("1100010111011110".charAt(nextInt() - 1));
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
		int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,1};
	  //              + + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Locale;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: "
							+ (System.currentTimeMillis() - prevTime) + " ms");
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		Object o = solve();
		if (o != null)
			out.println(o);
		out.close();
		in.close();
	}

	private Object solve() throws IOException {
		int[] answ =
			{
				1,	//altura everest
				0,	//largest board game tournament, este es el 8 y es false
				0,	//online math competition, este es el 4 y es false
				1, // nilo, muy cerca de wikipedia, ARRIBA DE 11
				1, // 1100km??????
				0, //angel falls venezuela
				0, // hotel enunciado
				1,// uranio
				0,// village siberia en 1933, checkear mejor
				1,// las pitones son mas largas
				0, // gato con pelo, ponele que true, revisar
				0, // sea otter tienen muchos, ponele que si
				1, //alaska es el mas grande
				0, //costa de alaska YO no creo
				1, // lago en rusia, parece que si
				0  //bandera turkmenistan

			};
		int index = ni();
		return answ[index-1];
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer strTok = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!strTok.hasMoreTokens())
			strTok = new StringTokenizer(in.readLine());
		return strTok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		strTok = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!strTok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			strTok = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}

	public void pln() {
		out.println();
	}

	public void pln(int arg) {
		out.println(arg);
	}

	public void pln(long arg) {
		out.println(arg);
	}

	public void pln(double arg) {
		out.println(arg);
	}

	public void pln(String arg) {
		out.println(arg);
	}

	public void pln(boolean arg) {
		out.println(arg);
	}

	public void pln(char arg) {
		out.println(arg);
	}

	public void pln(float arg) {
		out.println(arg);
	}

	public void pln(Object arg) {
		out.println(arg);
	}

	public void p(int arg) {
		out.print(arg);
	}

	public void p(long arg) {
		out.print(arg);
	}

	public void p(double arg) {
		out.print(arg);
	}

	public void p(String arg) {
		out.print(arg);
	}

	public void p(boolean arg) {
		out.print(arg);
	}

	public void p(char arg) {
		out.print(arg);
	}

	public void p(float arg) {
		out.print(arg);
	}

	public void p(Object arg) {
		out.print(arg);
	}

}

import java.util.Scanner;
public class MAIN {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		String b = "1001010111001010";
		System.out.print(b.charAt(a));
	}
}

import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class D {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		out.println("1001010111001110".charAt(nextInt() - 1));
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

import java.io.*;
import java.util.*;

public class C {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	long nextLong() throws Exception {
		return Long.parseLong(next());
	}

	double nextDouble() throws Exception {
		return Double.parseDouble(next());
	}

	void solve() throws Exception {
	//  int ans[] = {-1,1,0,0,1,0,1,0,1,1,1,0,1,1,0,1,0};

		int ans[] = {-1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,1,0};
	  //              + + + + + + + + + + + + + + + + +
		out.println(ans[nextInt()]);
	}

	void run() {
		try {
			Locale.setDefault(Locale.US);
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public static void main(String[] args) {
		new C().run();
	}

}

import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[n * 1000000];
        Arrays.fill(a, 57);
        if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 12 || n == 13 || n == 14 || n == 15 || n == 11) {
            out.println(1);
        } else {
            out.println(0);
        }
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}