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

public class Main {

    public static void main(String[] args) throws IOException {

        new Main().go();
    }

    PrintWriter out;
    Reader in;
    BufferedReader br;

    Main() throws IOException {

        try {

            //br = new BufferedReader( new FileReader("input.txt") );
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            //br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }
    }

    void go() throws IOException {

        int t = 1;
        while (t > 0) {
            solve();
            //out.println();
            t--;
        }

        out.flush();
        out.close();
    }

    int inf = 2000000000;
    int mod = 1000000007;
    double eps = 0.00000001;

    int n;
    int m;

    ArrayList<Integer>[] g = new ArrayList[200000];
    HashMap<Integer, HashMap<Integer, Boolean>> map = new HashMap<>();

    void solve() throws IOException {

        int l = in.nextInt();
        int r = in.nextInt();

        int x = in.nextInt();
        int y = in.nextInt();

        int k = in.nextInt();

        for (int i = x; i <= y; i++) if (1l*k*i >= l && 1l*k*i <= r) { out.println("YES"); return } out.println("NO");

    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            if (a > p.a) return 1;
            if (a < p.a) return -1;
            if (b > p.b) return 1;
            if (b < p.b) return -1;
            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}


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

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

	static class Task	{
		public void solve(InputReader in, PrintWriter out)	{
			solve(1, in, out);
		}

		public void solve(int testCase, InputReader in, PrintWriter out)	{
			long l = in.nextLong(), r = in.nextLong(), x = in.nextLong(), y = in.nextLong(), k = in.nextLong();
			if(k < (1.0*l)/y || k > (1.0*r)/x)	{
				System.out.println("NO");
			}	else {
				System.out.println("YES");
			}
		}

		public void run()	{
			InputReader in = new InputReader(System.in);
			PrintWriter out = new PrintWriter(System.out);
			solve(in, out);
			out.close();
		}

		static 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 SolutionA {
	public static void main(String argv[]) {
		Scanner stdin = new Scanner(System.in);

		String answer;
		final double EXP_LOW    = stdin.nextDouble(),
			  	  	 EXP_HI     = stdin.nextDouble(),
			  	  	 COST_LOW   = stdin.nextDouble(),
			  	  	 COST_HI    = stdin.nextDouble(),
			  	  	 EFFICIENCY = stdin.nextDouble();

		if(EFFICIENCY >= EXP_LOW/COST_HI && EFFICIENCY <= EXP_HI/COST_LOW)
			answer = "YES";
		else
			answer = "NO";

		System.out.println(answer);
	}
}


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

public class a {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		Task solver = new Task();
		//int t = scan.nextInt();
		int t = 1;
		for(int i = 1; i <= t; i++) solver.solve(i, scan, out);
		out.close();
	}

	static class Task {

		public void solve(int testNumber, FastReader sc, PrintWriter pw) {
			long l = sc.nextInt();
			long r = sc.nextInt();
			long a = sc.nextInt();
			long b = sc.nextInt();
			long k = sc.nextInt();
			for(int i=a;i<=b;i++){
				if(i*k<=r&&i*k>=l){
					pw.println("YES");
					return;
				}
			}
			pw.println("NO");
		}
	}

	static void shuffle(int[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			int temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static void shuffle(long[] a) {
		Random get = new Random();
		for (int i = 0; i < a.length; i++) {
			int r = get.nextInt(a.length);
			long temp = a[i];
			a[i] = a[r];
			a[r] = temp;
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastReader(String s) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(new File(s)));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				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());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String bits = sc.next();
        int c = 1;
        for(int i=0; i<n;i++) {
            if(bits.chatAt(i) == '0') break;
            c++;
        }

        System.out.print(c);
    }
}


public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int i = in.nextInt(); int j = in.nextInt(); int answer = 0;
        int[] num = new int[i]; for(int c = i-1; c > -1; c--) {num[c] = j % 10; j /= 10;}
        boolean go = true; int last = -1;
        for(int c = 0; c < i && go; c++)
        {
            if(num[c] + 1 > 1) answer++;
            else {go = false; last = c;}
        }
        if(last != -1) answer++;
        System.out.print(answer);
    }
}


public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int i = in.nextInt(); int j = in.nextInt(); int answer = 0;
        int[] num = new int[i]; for(int c = i-1; c > -1; c--) {num[c] = j % 10; j /= 10;}
        boolean go = true; int last = -1;
        for(int c = 0; c < i && go; c++)
        {
            if(num[c] + 1 > 1) answer++;
            else {go = false; last = c;}
        }
        if(last != i-1 && last != -1) answer++;
        System.out.print(answer);
    }
}


public class Problem465A {
    public static void main(String[] args) throws IOException {
        fastinput.init(System.in);
        int n = fastinput.nextInt();
        String bits = fastinput.next();
        char[] bitsArray = bits.toCharArray();
        int count = 0;
        boolean carryOver = false;
        boolean startAdd = true;
        for (Character bit : bitsArray) {
            if (bit.charValue() == '0') {
                if (startAdd) {
                    bit = '1';
                    count++;
                    startAdd = false;
                    continue;
                }
                if (carryOver) {
                    bit = '1';
                    count++;
                    carryOver = false;
                }
                continue;
            }
            if (bit.charValue() == '1') {
                if (startAdd) {
                    bit = '0';
                    count++;
                    startAdd = false;
                    carryOver = true;
                    continue;
                }
                if (carryOver) {
                    bit = '0';
                    count++;
                    carryOver = true;
                    continue;
                }
                carryOver = false;
                continue;
            }
        }
        System.out.println(count);
    }

    public static class fastinput {
        static BufferedReader bf;
        static StringTokenizer st;

        static void init(InputStream input) {
            bf = new BufferedReader(new InputStreamReader(input));
            st = new StringTokenizer("");
        }

        static String nextline() throws IOException {
            return bf.readLine();
        }

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

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

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


import android.widget.ArrayAdapter;

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

public class TaskB {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;

    public static void main(String[] args) throws IOException {
        int n = nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
            a[i] = nextInt();
        int T = nextInt();
        Arrays.sort(a);
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < n; i++) {
            int count = 0;
            for(int j = i + 1; j < n; j++)
                if(a[j] - a[i] <= T)
                    ++count;
            if(count > max)
                max = count;
        }
        System.out.println(max);
    }

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

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

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

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

}


import java.util.Arrays;
import java.util. Scanner;
public class Main {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int n = s.nextInt();
        int []a = new int [n];
        for(int i = 0;i<a.length;i++)
        {
            a[i]=s.nextInt();
        }
        int t = s.nextInt();
        Arrays.sort(a);
        int br = 0;
        int max=0;
        for(int i = a.length-1;i>=1;i--)
        {
            int k = i;
            i--;
            while(a[k]-a[i]<=t)
            {
                i--;
                br++;
            }
            br++;
            if(max<br)max=br;
            br=0;
        }
        System.out.println(max);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
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 n = ni();
		int[] arr = nia(n);
		Arrays.sort(arr);
		int t = ni();
		int ret =0;
		for(int i =0;i<n;i++)
			for(int j =i+1;j<n;j++)
				if(arr[j]-arr[i]<=t)
					ret = Math.max(ret, j-i+1);
		return ret;
	}

	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";
	}
}


import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

import static java.lang.Math.min;
import static java.lang.Math.max;

/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReader(System.in));
pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
 */

public class Main {
	private static BufferedReader br;
	private static StringTokenizer st;
	private static PrintWriter pw;

	public static void main(String[] args) throws IOException	{
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int qq = 1;
		//int qq = Integer.MAX_VALUE;
		//int qq = readInt();
		for(int casenum = 1; casenum <= qq; casenum++)	{
			int n = readInt();
			int[] list = new int[n];
			for(int i = 0; i < n; i++) {
				list[i] = readInt();
			}
			int diff = readInt();
			int ret = 0;
			Arrays.sort(list);
			for(int i = 0; i < n; i++) {
				for(int j = i+ret; j < n; j++) {
					if(list[j] - list[i] <= diff) {
						ret = j = i + 1;
					}
				}
			}
			pw.println(ret);
		}
		pw.close();
	}

	private static void exitImmediately()	{
		pw.close();
		System.exit(0);
	}

	private static long readLong() throws IOException	{
		return Long.parseLong(nextToken());
	}

	private static double readDouble() throws IOException	{
		return Double.parseDouble(nextToken());
	}

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

	private static String nextToken() throws IOException	{
		while(st == null || !st.hasMoreTokens())	{
			if(!br.ready())	{
				exitImmediately();
			}
			st = new StringTokenizer(br.readLine().trim());
		}
		return st.nextToken();
	}
}


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

public class Main implements Runnable {

	public void solve() throws IOException {
		int answer = -1;
                long N = nextInt();
                long M = nextInt();
                long K = nextInt();

                if(K <= (N - 1 + M - 1)){
                    if(K < N)
                        answer = Math.max(answer, M * (N / (K+1)));
                    else
                        answer = Math.max(answer, M / (N - K + 2));

                    if(K < M)
                        answer = Math.max(answer, N * (M / (K+1)));
                    else
                        answer = Math.max(answer, N / (M - K + 2));
                }

                System.out.println(answer);
	}

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

        public void print1Int(int[] a){
                for(int i = 0; i < a.length; i++)
                        System.out.print(a[i] + " ");
                System.out.println();
        }

        public void print2Int(int[][] a){
                for(int i = 0; i < a.length; i++){
                        for(int j = 0; j < a[0].length; j++){
                                System.out.print(a[i][j] + " ");
                        }
                        System.out.println();
                }
        }

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tok = null;
			solve();
			in.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

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

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

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

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

	BufferedReader in;
	StringTokenizer tok;
}


import java.util.*;
public class ProbA {
public static void main(String [] args){
Scanner in=new Scanner(System.in);
long n=in.nextLong();
int m=in.nextLong();
int k=in.nextLong();
long a=Math.max(n,m);
long b=Math.min(n,m);
if(k>m+n-2)
System.out.println("-1");
else if(a%(k+1)==0||b%(k+1)==0)
System.out.println(a*b/(k+1));
else if(a*b%(k+1)==0 && k>b-1 && a%(k+b)==0){
k-=b-1;
System.out.println(a*b/(k+1));
}
else if(k<=a-1){
System.out.println(((a/(k+1))*b));
}
else if(k>a-1){
k-=(a-1);
System.out.println((b/(k+1)));
}
}
}


package 湖南大学;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class F {
     static  long  a;
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(
            new InputStreamReader(System.in)));
    public static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }
public static void main (String args []) throws IOException
{
   long  a,n,m;
   long ans;
   n=nextInt();
   m=nextInt();
   a=nextInt();
 ans=Math.max(OK(n,m), OK(m,n));
System.out.println(ans);
}
public static long  OK(long n ,long m)
{
    long ans;
    if (n>a+1)
       {
           ans=(n/(a+1));
           ans=ans*m;
       }
       else
       {
           a=a+2-n;
           if(m<a)
               ans=-1;
           else
               ans=m/a;
       }
    return ans;
}
}


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

public class A {

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

	void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		int k = nextInt();
		if (k > n + m - 2) {
			out.println(-1);
			return;
		}

		long ans = 0;

		for (int a = 0; a < 10000; a++) {
			long b = k - a;
			if (a < 0 || a >= n || b < 0 || b >= m) {
				continue;
			}
			ans = Math.max(ans, (long) (n / (a + 1)) * (long) (m / (b + 1)));
		}

		for (int b = 0; b < 10000; b++) {
			int a = k - b;
			if (a < 0 || a >= n || b < 0 || b >= m) {
				continue;
			}
			ans = Math.max(ans, (long) (n / (a + 1)) * (long) (m / (b + 1)));
		}

		out.println(ans);
	}

	A() 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 A();
	}

	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());
	}
}


public class Test {

	public static void main(String[] args) throws IOException {

		Scanner input = new Scanner(System.in);

		int socks = input.nextInt();
		int frequency = input.nextInt();

		int result = socks;

		while(socks/frequency > 0) {
			socks /= frequency;
			result += socks;
		}

		System.out.println("" +result);

	}

}


import java.util.*;
 public class Mera_Code_Hai {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int pehla = sc.nextInt();
        int dusra = sc.nextInt();
        int fuckOff = 0;
        for(int Lega_kya =1;Lega_kya<=n;Lega_kya++)
        {
            fuckOff++;
            if(Lega_kya % dusra == 0) pehla++;
        }
        System.out.println(fuckOff);

    }
}


import java.util.*;
public class asdd
{
         public static void main(String args[])throws Exception
         {
                  Scanner s=new Scanner(System.in);
                  int m=s.nextInt();
                  int n=s.nextInt();
                  int count=m;
                  int count2=m/n;int a=m/n;
while(count2>0)
{
         if(m%n==0)
         count=count+1;
         m++;
         count2--;
}
System.out.printlnl(count+m);
}


import java.util.Scanner;

public class VasyaAndSocks{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int numSocks = scan.nextInt();
        int numDays = scan.nextInt();

        int consecutiveDays = 0;

        while(numSocks > 0){
            consecutiveDays += Math.min(numDays,numSocks);
            numSocks -= numDays, numSocks;
            numSocks++;

        }

        System.out.println(consecutiveDays);
    }
}


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

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

    static class Palindrome {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong();

            if(l%4 == 0 || l%4 == 3)
            {
                out.print("0");
            }
            else
            {
                out.print("1");
            }
        }

    }

    static 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 long nextInt(){
            return Long.parseLong(next());
        }

    }
}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Codeforce
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new scanner(System.in);
		int n=sc.nextInt();
		if(n%2==0)
		 System.out.println("1");
		else
		    System.out.println("0");
	}
}


public class file {
    public static void main(String[]args){
        Scanner s=new Scanner (System.in);
        int n=s.nextInt();
        s.close();
        int val=n%4;
        if (val==0||val==3)
        System.out.print(0);
        else
        System.out.print(1);
    }
}


import java.util.*;
public class Isd{
    public static void main(String arp[]){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        n = n%4;
        int ans  = 0;
        if(n==0 || n==3)    ans=0;
        if(n==1 || n==2)    ans =1;
        system.out.println(ans);
    }
}


import java.util.*;

public class Main
{
    public static void main(String args)
    {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        ArrayList<Integer> num=new ArrayList<Integer>();
        while(n>0)
        {
            num.add(0,n%10);
            n=n/10;
        }

        while(num.size()>0)
        {
            StringBuilder sb=new StringBuilder();
            for(int i=0;i<num.size();i++)
            {
                if(num.get(i)>0)
                {
                    num.set(i,sb.get(i)-1);
                    sb.append('1');
                }
                else
                {
                    sb.append('0');
                }
            }
            System.out.println(sb.toString());
            while(num.size()>0&&num.get(0)==0)
            {
                num.remove(0);
            }
        }
    }
}


// Working program using Reader Class
import java.util.*;

public class QuasiBinary
{

    public static void main(String[] args) throws IOException
    {
        Scanner sc= new Scanner(System.in);
        char[] s= sc.readLine().toCharArray();
        int n= s.length;
        List<String> res= new ArrayList<>();
        boolean finish=true;
        while(true){
            finish=true;
            StringBuilder sb= new StringBuilder("");
            for(int i=0;i<n;i++){
                if(s[i]=='0'){
                    sb.append("0");
                    continue;
                }
                finish=false;
                sb.append("1");
                s[i]--;
            }
            if(finish) break;
            res.add(sb.toString());
        }
        System.out.println(res.size());
        for(int i=0;i<res.size();i++){
            System.out.print(res.get(i)+" ");
        }

    }
}


import java.util.*;
public class quasi{
	public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	int number= sc.nextInt();
	List<Integer> list= new ArrayList<Integer>();
	String str=""+number;int c=0;
	while(number>0){
	String b="";
     for(int i=0;i<str.length;i++){
     if(str.charAt(i)>'0')
     b+="1";
     else
     b+='0';}
     c=Integer.parseInt(b);
     list.add(c);
     number=number-c;
	}
	System.out.println(list.size());
	for(int a:list)
	System.out.print(a+" ");
	}
}


import java.util.*;

public class B538 {
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a[]=new int[9];
		int c=0;
		int k=1;
		while(n!=0){
			int r=n%10;
			if(r>c) c=r;
			for(int i=0;i<r;i++)
				a[i]=a[i]+k;
			n=n/10;
			k=k*10;
		}

		System.out.println(c);
		for(int i=0;i<ans;i++)
			System.out.print(a[i]+" ");
	}

}


import java.util.*;
import java.io.*;
public class A
{
      public static void main(String ar[]) throws Exception
      {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String s1[]=br.readLine().split(" ");
            String s2[]=br.readLine().split(" ");
            int n=Integer.parseInt(s1[0]);
            int m=Integer.parseInt(s1[1]);
            int l=Integer.parseInt(s1[2]);
            int r=Integer.parseInt(s1[3]);
            long g=Long.parseLong(s2[0]);
            long x=Long.parseLong(s2[1]);
            long y=Long.parseLong(s2[2]);
            long z=Long.parseLong(s2[3]);

            long a[][]=new long[n][m];
            long b[][]=new long[n][m];
            long c[][]=new long[n][m];
            for(int i=0;i<n;i++)
            {
                  for(int j=0;j<m;j++)
                  {
                        a[i][j]=g;
                        g=(g*x+y)%z;
                  }
            }

            for(int j=0;j<m;j++)
            {
                  Deque<Integer> dq=new LinkedList<Integer>();
                  for(int i=0;i<l;i++)
                  {
                        while(!dq.isEmpty() && a[i][j]<=a[dq.peekLast()][j])
                         dq.pollLast();
                        dq.addLast(i);
                  }

                  for(int i=l;i<n;i++)
                  {
                        b[i-1][j]=a[dq.peek()][j];
                        while(!dq.isEmpty() && dq.peek()<=i-l)
                         dq.poll();
                        while(!dq.isEmpty() && a[i][j]<=a[dq.peekLast()][j])
                         dq.pollLast();
                        dq.addLast(i);
                  }
                  b[n-1][j]=a[dq.peek()][j];
            }

            for(int i=l-1;i<n;i++)
            {
               Deque<Integer> dq=new LinkedList<Integer>();
               for(int j=0;j<r;j++)
               {
                     while(!dq.isEmpty() && b[i][j]<=b[i][dq.peekLast()])
                      dq.pollLast();
                     dq.addLast(j);
               }

               for(int j=r;j<m;j++)
               {
                    //System.out.println(i+" "+j);
                    c[i][j-1]=b[i][dq.peek()];
                    while(!dq.isEmpty() && dq.peek()<=j-r)
                     dq.poll();
                    while(!dq.isEmpty() && b[i][j]<=b[i][dq.peekLast()])
                      dq.pollLast();
                    dq.addLast(j);
               }
               c[i][m-1]=b[i][dq.peek()];
            }

            long S=0;
            StringBuffer sb=new StringBuffer();
            StringBuffer sb1=new StringBuffer();
            for(int i=0;i<n;i++)
            {
            for(int j=0;j<m;j++)
            {
              S+=c[i][j];
             sb.append(b[i][j]).append(" ");
             sb1.append(c[i][j]).append(" ");
            }
            sb.append("\n");
            sb1.append("\n");
            }
         //   System.out.println(sb);
         //   System.out.println();
         //   System.out.println(sb1);
         //   System.out.println();
            System.out.println(S);
      }
}


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

public class Main {

	static int[][] h;

	static void getInput(Scanner sc, int n, int m) throws IOException {
		int[] g = new int[n * m + n];
		g[0] = sc.nextInt();
		h = new int[n][m];
		int x = sc.nextInt(), y = sc.nextInt(), z = sc.nextInt();
		for (int i = 1; i < g.length; i++) {
			g[i] = (int) ((g[i - 1] * 1L * x + y) % z);
		}
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= m; j++) {
				h[i - 1][j - 1] = g[(i - 1) * m + j - 1];
			}
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), m = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt();
		getInput(sc, n, m);
		int[][] mins = new int[n][m]; // mins[i][j] = min value from a[i][j] to a[i][j+b-1]
		for (int i = 0; i < n; i++) {
			SparseTable row = new SparseTable(h[i]);
			for (int j = 0; j + b <= m; j++) {
				mins[i][j] = row.query(j, j + b - 1);
			}
		}
		long ans = 0;
		for (int j = 0; j + b <= m; j++) {
			int[] x = new int[n];
			for (int i = 0; i < n; i++)
				x[i] = mins[i][j];
			SparseTable col = new SparseTable(x);
			for (int i = 0; i + a <= n; i++)
				ans += col.query(i, i + a - 1);
		}
		out.println(ans);

		out.close();

	}

	static class SparseTable {
		// table [i][j] = the index with the min value from a[j] to
		// a[j+(1<<i)-1];

		int[] log, a, table[];

		SparseTable(int[] a) {
			this.a = a;
			int n = a.length;
			log = new int[n + 1];
			for (int i = 2; i <= n; i++)
				log[i] = log[i / 2] + 1;
			table = new int[log[n] + 1][n];
			for (int i = 0; i < n; i++)
				table[0][i] = i;
			for (int i = 1, len = 2; len < n; i++, len <<= 1)
				for (int j = 0; j + len <= n; j++) {
					int u = table[i - 1][j], v = table[i - 1][j + len / 2];
					table[i][j] = a[u] < a[v] ? u : v;
				}

		}

		int query(int l, int r) {
			int len = r - l + 1;
			int lg = log[len];
			int u = table[lg][l];
			int v = table[lg][r - (1 << lg) + 1];
			int bestIdx = a[u] < a[v] ? u : v;
			return a[bestIdx]; // return a[bestIdx] for value
		}

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

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

		String nextLine() throws IOException {
			return br.readLine();
		}

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

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

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

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}


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

public class Es5
{
    static IO io = new IO();
    public static void main(String[] args)
    {
		int n = io.getInt();
		int m = io.getInt();
		int a = io.getInt();
		int b = io.getInt();
		long g = io.getInt();
		long x = io.getInt();
		long y = io.getInt();
		long z = io.getInt();

		BigInteger gi = new BigInteger("0");
		int[][] ar = new int[n][m];
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				ar[i][j] = g;
				g = (g*x + y)%z;
				//io.print(ar[i][j]+" ");
			}
			//io.println();
		}

		int[][] pass1 = new int[n][];
		for(int i=0; i<n; i++)
			pass1[i] = slidingWindowMin(ar[i], m, b);

		int[][] pass2 = new int[pass1[0].length][pass1.length];
		for(int i=0; i<pass1.length; i++)
			for(int j=0; j<pass1[0].length; j++)
				pass2[j][i] = pass1[i][j];

		int[][] pass3 = new int[pass2.length][];
		for(int i=0; i<pass3.length; i++)
			pass3[i] = slidingWindowMin(pass2[i], pass2[i].length, a);

		long ans = 0;

		for(int[] t : pass3)
			for(Integer tmp : t)
				ans += tmp;
		io.println(ans);
        io.close();
    }

	static int[] slidingWindowMin(int arr[], int n, int k)
    {
		int[] sol = new int[n-k+1];
		int c=0;
        // Create a Double Ended Queue, Qi that will store indexes of array elements
        // The queue will store indexes of useful elements in every window and it will
        // maintain decreasing order of values from front to rear in Qi, i.e.,
        // arr[Qi.front[]] to arr[Qi.rear()] are sorted in decreasing order
        Deque<Integer> Qi = new LinkedList<Integer>();

        /* Process first k (or first window) elements of array */
        int i;
        for (i = 0; i < k; ++i) {
            // For every element, the previous smaller elements are useless so
            // remove them from Qi
            while (!Qi.isEmpty() && arr[i] <= arr[Qi.peekLast()])
                Qi.removeLast(); // Remove from rear

            // Add new element at rear of queue
            Qi.addLast(i);
        }

        // Process rest of the elements, i.e., from arr[k] to arr[n-1]
        for (; i < n; ++i) {
            // The element at the front of the queue is the largest element of
            // previous window, so print it
			sol[c++] = arr[Qi.peek()];

            // Remove the elements which are out of this window
            while ((!Qi.isEmpty()) && Qi.peek() <= i - k)
                Qi.removeFirst();

            // Remove all elements smaller than the currently
            // being added element (remove useless elements)
            while ((!Qi.isEmpty()) && arr[i] <= arr[Qi.peekLast()])
                Qi.removeLast();

            // Add current element at the rear of Qi
            Qi.addLast(i);
        }
		sol[c] = arr[Qi.peek()];
        // Print the maximum element of last window
		return sol;
    }
}

class IO extends PrintWriter {
	public IO() {
        super(new BufferedOutputStream(System.out));
        r = new BufferedReader(new InputStreamReader(System.in));
    }

    public IO(String fileName) {
        super(new BufferedOutputStream(System.out));
        try{
            r = new BufferedReader(new FileReader(fileName));
        } catch (FileNotFoundException e) {
            this.println("File Not Found");
        }
    }

    public boolean hasMoreTokens() {
        return peekToken() != null;
    }

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

    public double getDouble() {
        return Double.parseDouble(nextToken());
    }

    public long getLong() {
        return Long.parseLong(nextToken());
    }

    public String getWord() {
        return nextToken();
    }

	public String getLine(){
        try{
            st = null;
            return r.readLine();
        }
        catch(IOException ex){}
        return null;
    }

    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
        if (token == null)
            try {
                while (st == null || !st.hasMoreTokens()) {
                    line = r.readLine();
                    if (line == null) return null;
                    st = new StringTokenizer(line);
                }
                token = st.nextToken();
            } catch (IOException e) { }
        return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.concurrent.ThreadLocalRandom;

public class Main2 {

    static int mod = 998244353;
    static FastScanner scanner;

    /*
    3000 3000 1000 1000
1 2 3 59123405
     */
    public class SimpleSegmentTree {
        int[] t;
        int n;

        public SimpleSegmentTree(int n) {
            t = new int[2 * n];
            Arrays.fill(t, Integer.MIN_VALUE);
            this.n = n;
        }

        public void build(int[] a) {  // build the tree
            n = a.length;
            t = new int[2 * n];
            System.arraycopy(a, 0, t, n, n);
            for (int i = n - 1; i > 0; --i) t[i] = Math.min(t[i<<1], t[i<<1|1]);
        }

        public void modify(int p, int value) {  // set value at position p
            for (t[p += n] = value; p > 1; p >>= 1) t[p>>1] = Math.min(t[p], t[p^1]);
        }

        public int query(int l, int r) {  // sum on interval [l, r)
            int res = Integer.MAX_VALUE;
            for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
                if ((l&1) != 0) res = Math.min(res, t[l++]);
                if ((r&1) != 0) res = Math.min(res, t[--r]);
            }
            return res;
        }
    }

    public static void main(String[] args) {
        scanner = new FastScanner();
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();

        long g0 = scanner.nextInt();
        long x = scanner.nextInt();
        long y = scanner.nextInt();
        long z = scanner.nextInt();

        int[][] matrix = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                matrix[i][j] = (int) g0;
                g0 = ((g0 * x) % z + y) % z;
            }
        }

        SimpleSegmentTree[] mins = new SimpleSegmentTree[n];
        for (int i = 0; i < n; i++) {
            mins[i] = new SimpleSegmentTree(m);
            mins[i].build(matrix[i]);
        }

        long result = 0;

        for (int j = 0; j < m - b + 1; j++) {
            int[] mm = new int[n];
            for (int i = 0; i < n; i++) {
                mm[i] = mins[i].query(j, j + b);
            }
            SimpleSegmentTree window = new SimpleSegmentTree(n);
            window.build(mm);
            for (int i = 0; i < n - a + 1; i++) {
                result += window.query(i, i + a);
            }
        }
        System.out.println(result);

    }

    static class Mins {
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();

        int min() {
            return 0;//priorityQueue.peek();
        }

        void remove(int a) {
            //priorityQueue.remove(a);
        }

        void add(int a) {
            //priorityQueue.add(a);
        }
    }

    static class WithIdx {
        int val, idx;

        public WithIdx(int val, int idx) {
            this.val = val;
            this.idx = idx;
        }
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            try {
                return br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException();
            }
        }

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

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

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

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

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

        String[] nextStringArray(int n) {
            String[] res = new String[n];
            for (int i = 0; i < n; i++) res[i] = nextToken();
            return res;
        }
    }

    static class PrefixSums {
        long[] sums;

        public PrefixSums(long[] sums) {
            this.sums = sums;
        }

        public long sum(int fromInclusive, int toExclusive) {
            if (fromInclusive > toExclusive) throw new IllegalArgumentException("Wrong value");
            return sums[toExclusive] - sums[fromInclusive];
        }

        public static PrefixSums of(int[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }

        public static PrefixSums of(long[] ar) {
            long[] sums = new long[ar.length + 1];
            for (int i = 1; i <= ar.length; i++) {
                sums[i] = sums[i - 1] + ar[i - 1];
            }
            return new PrefixSums(sums);
        }
    }

    static class ADUtils {
        static void sort(int[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                int a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }

        static void reverse(int[] arr) {
            int last = arr.length / 2;
            for (int i = 0; i < last; i++) {
                int tmp = arr[i];
                arr[i] = arr[arr.length - 1 - i];
                arr[arr.length - 1 - i] = tmp;
            }
        }

        static void sort(long[] ar) {
            Random rnd = ThreadLocalRandom.current();
            for (int i = ar.length - 1; i > 0; i--)
            {
                int index = rnd.nextInt(i + 1);
                // Simple swap
                long a = ar[index];
                ar[index] = ar[i];
                ar[i] = a;
            }
            Arrays.sort(ar);
        }
    }

    static class MathUtils {
        static long[] FIRST_PRIMES = {
                2,     3,      5,      7,     11,     13,     17,     19,     23,     29,
                31,     37,     41,     43,     47,     53,     59,     61,     67,     71,
                73,     79,     83,     89  ,   97 ,    101,    103,    107,    109,    113,
                127,    131,    137,    139,    149,    151,    157,    163,    167,    173,
                179,    181,    191,    193,    197,    199,    211,    223,    227,    229,
                233,    239,    241,    251,    257,    263,    269,    271,    277,    281,
                283,    293,    307,    311,    313,    317,    331,    337,    347,    349,
                353,    359,    367,    373,    379,    383,    389,    397,    401,    409,
                419,    421,    431,    433,    439,    443,    449,    457,    461,    463,
                467,    479,    487,    491,    499,    503,    509,    521,    523,    541,
                547,    557,    563,    569,    571,    577,    587,    593,    599,    601,
                607,    613,    617,    619,    631,    641,    643,    647,    653,    659,
                661,    673,    677,    683,    691,    701,    709,    719,    727,    733,
                739,    743,    751,    757,    761,    769,    773,    787,    797,    809,
                811,    821,    823,    827,    829,    839,    853,    857,    859,    863,
                877,    881,    883,    887,    907,    911,    919,    929,    937,    941,
                947,    953,    967,    971,    977,    983,    991,    997,   1009,   1013,
                1019,   1021,   1031,   1033,   1039,   1049,   1051};

        static long[] primes(int to) {
            long[] all = new long[to + 1];
            long[] primes = new long[to + 1];
            all[1] = 1;
            int primesLength = 0;
            for (int i = 2; i <= to; i ++) {
                if (all[i] == 0) {
                    primes[primesLength++] = i;
                    all[i] = i;
                }
                for (int j = 0; j < primesLength && i * primes[j] <= to && all[i] >= primes[j]; j++) {
                    all[(int) (i * primes[j])] = primes[j];
                }
            }
            return Arrays.copyOf(primes, primesLength);
        }

        static long modpow(long b, long e, long m) {
            long result = 1;

            while (e > 0) {
                if ((e & 1) == 1) {
                    /* multiply in this bit's contribution while using modulus to keep
                     * result small */
                    result = (result * b) % m;
                }
                b = (b * b) % m;
                e >>= 1;
            }

            return result;
        }

        static long submod(long x, long y, long m) {
            return (x - y + m) % m;
        }
    }
}


import java.util.*;
import java.util.Scanner;
public class HorseShoe{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int hoof1 = sc.nextInt();
  int hoof2 = sc.nextInt();
  int hoof3 = sc.nextInt();
  int hoof4 = sc.nextInt();
  ArrayList<int> horseShoes = new ArrayList<int>();
  horseShoes.add(hoof1);
  horseShoes.add(hoof2);
  horseShoes.add(hoof3);
  horseShoes.add(hoof4);
  int same = 0;
  int len = horseShoes.size();
  for(int i = 0; i<len; i++){
    int j = i+1;
    while(j<len){
    if(horseShoes.get(i)== horseShoes.get(j)){
    same++;
    horseShoes.remove(j);
    }

    else j++;
    }
  }

  System.out.print(same);
  }}


import java.util.*;
import java.util.Scanner;
public class Horseshoes{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int[] horseShoes = new int[4];
  for(int i = 0; i<4; i++){
horseShoes[i] = sc.nextInt();
  }
  int same = 0;
  Arrays.sort(horseShoes);

  for(int i = 0; i<3; i++){
    if(horseShoes[i]=horseShoes[i+1])
    same++;
    }

      System.out.print(same);

    }
  }


import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int[] arr = new int[4];
        for (int i = 0; i < 4; i++) {
            arr[i] = input.nextInt();
        }
        Arrays.sort(arr);
        int cnt = 0;
        for(int i = 0; i < 3; i++) {
            if (arr[i] == arr[i+1]){
                cnt++;
            }
        }

       System.out.println(cnt);

    }


import java.util.Scanner;

/**
 *
 * @author ahmed sabrey
 */
public class JavaApplication81 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
         Scanner in = new Scanner(System.in);

        Long []s = new Long [4];

       int i , j , x = 0, count=0 ;

        for (i=0; i<4; i++){
             s[i] = in.nextLong();

        }
       for (i=0; i<4; i++){
           for (j=i+1; j<4; j++){
               if (Objects.equals(s[i], s[j])){
                   count++;
                x =  (int) (count);            }
           }
       }
       if (count == 1|| count == 0){
        System.out.println(count);
       }
       else {System.out.println(count/2);}

}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class C {

	static class Scanner{
		BufferedReader br=null;
		StringTokenizer tk=null;
		public Scanner(){
			br=new BufferedReader(new InputStreamReader(System.in));
		}
		public String next() throws IOException{
			while(tk==null || !tk.hasMoreTokens()) {
				String cad = br.readLine();
				if (cad == null)
					return null;
				tk=new StringTokenizer(cad);
			}
			return tk.nextToken();
		}
		public int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		public long nextLong() throws NumberFormatException, IOException{
			return Long.valueOf(next());
		}
		public double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}

	static int N;
	static int[] array;
	static boolean[] visited;

	static int find(int index, int first, int count) {
		if (visited[index])
			return -1;
		visited[index] = true;
		if (count == N && index != first)
			return -1;
		if (index == first)
			return count;
		return find(array[index], first, count + 1);
	}

	public static void main(String args[]) throws NumberFormatException, IOException {
		Scanner sc = new Scanner();
		N = sc.nextInt();
		array = new int[N];
		for(int i = 0; i < N; i++)
			array[i] = sc.nextInt() - 1;
		visited = new boolean[N];
		Arrays.fill(visited, false);
		TreeSet<Integer> tams = new TreeSet<Integer>();
		for(int i = 0; i < N; i++) {
			if (visited[i])
				continue;
			int ans = find(array[i], i, 1);
			if (ans == -1){
				System.out.println(-1);
				return;
			}
			if (ans > 1)
				tams.add(ans);
		}
		if (tams.size() == 0)
			System.out.println(1);
		else if (tams.size() == 1)
			System.out.println(tams.first() % 2 == 0 ? tams.first() / 2 : tams.first());
		else if (tams.size() == 2) {
			int first = tams.first();
			int last = tams.last();
			if (2*first == last)
				System.out.println(first);
			else
				System.out.println(-1);
		}
		else
			System.out.println(-1);
	}

}


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

public final class ProblemC {
    private static boolean hasVertexWithZeroInDegree(final int[] out) {
        final int[] in = new int[out.length];
        for (int to: out) {
            in[to]++;
        }
        for (int indegree: in) {
            if (indegree == 0) {
                return true;
            }
        }
        return false;
    }

    private int cycleLength(
            final int[] out,
            final int i,
            final boolean[] visited) {
        int length = 1;
        for (int to = out[i]; to != i;) {
            length++;
            visited[to] = true;
            to = out[to];
        }
        return length;
    }

    private static int gcd(final int a, final int b) {
        if (a < b) {
            return gcd(b, a);
        } else if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

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

    public static void main(final String[] args) {
        final Scanner in = new Scanner(System.in);
        final int n = in.nextInt();
        final int[] crush = new int[n];
        for (int i = 0; i < n; i++) {
            crush[i] = in.nextInt();
        }
        if (hasVetexWithZeroInDegree(crush)) {
            System.out.println(-1);
        }

        List<Integer> cycles = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (visited[i]) {
                continue;
            }
            final int cycleLength = cycleLength(crush, i, visited);
            cycles.add(cycleLength);
        }

        if (cycles.size() == 1) {
            System.out.println(cycles.get(0));
        } else {
            int lcm = lcm(cycles.get(0), cycles.get(1));
            for (int i = 2; i < cycles.size(); i++) {
                lcm = lcm(lcm, cycles.get(i));
            }
            System.out.println(lcm);
        }
    }
}


import java.util.*;

public class M{
    static Scanner sc;
    public long gcd(long a,long b)
    {
	    if(b>a)
		    swap(a,b);
        long c;
	    while(b>0)
	    {
		    c=a%b;	a=b;	b=c;
	    }
	    return a;
    }
    public void swap(long a, long b){
		long tmp = a;
		a = b;
		b = tmp;
	}
    public static void main(String []args){
        sc = new Scanner(System.in);
        int n=sc.nextInt();
        int num=1;
        int []a=new int[n+1];
        int []b=new int[n+1];
        while (sc.hasNext()){
            a[num]=sc.nextInt();
            num++;
        }
        long ans=1;
		int flag=0;
		for(int i=1;i<=n;++i)
		{
			if(b[i])
				continue;
			long temp=1;
			int y=a[i];
			b[i]=1;
			while(y!=i){
				b[y]=1;
				y=a[y];
				temp++;
				if(temp>n){
					flag=1;
					break;
				}
			}
			if(flag==1)
				break;
			if(temp%2==0)
				temp/=2;
			ans = ans/gcd(ans,temp)*temp;
		}
		if(flag)
			System.out.print("-1\n");
		else System.out.print("%lld\n",ans);
    }
}


import java.util.*;

public class M{
    static Scanner sc;
    public void swap(long a, long b){
		long tmp = a;
		a = b;
		b = tmp;
	}
    public static long gcd(long a,long b)
    {
	    if(b>a)
		    swap(a,b);
        long c;
	    while(b>0)
	    {
		    c=a%b;	a=b;	b=c;
	    }
	    return a;
    }

    public static void main(String []args){
        sc = new Scanner(System.in);
        int n=sc.nextInt();
        int num=1;
        int []a=new int[n+1];
        int []b=new int[n+1];
        while (sc.hasNext()){
            a[num]=sc.nextInt();
            num++;
        }
        long ans=1;
		int flag=0;
		for(int i=1;i<=n;++i)
		{
			if(b[i]==1)
				continue;
			long temp=1;
			int y=a[i];
			b[i]=1;
			while(y!=i){
				b[y]=1;
				y=a[y];
				temp++;
				if(temp>n){
					flag=1;
					break;
				}
			}
			if(flag==1)
				break;
			if(temp%2==0)
				temp/=2;
			ans = ans/gcd(ans,temp)*temp;
		}
		if(flag)
			System.out.print("-1\n");
		else System.out.print("%lld\n",ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;import javax.annotation.Generated;

public class Main {
	public static long generateNine(int len) {
		int res=0;

		while(len!=0)
		{

			res*=10;
			res+=9;
			len--;
		}

		return res;

	}
	public static int countNine(String number) {

		int counter=0;
		for(int i=number.length()-1;i>=0;i--)
		{

			if(number.charAt(i)!='9')
				break;
			counter++;

		}

		return counter;

	}

	public static void main(String[] args) throws IOException {
		FastReader in = new FastReader();
		String num=in.next();
		long number=Long.parseLong(num);
		int initial=countNine(num);
		String res=num;
		long range=in.nextLong();
		long generatedNine=generateNine(num.length()-1);
		if(initial>=num.length()-1||range==0)
		{
			System.out.println(num);
			return ;
		}
		else if(number%generatedNine<=range)
		{

			System.out.println(generatedNine);
			return ;

		}

		for(long i=1;i<=range;i++)
		{
			String x = String.valueOf(number-i);
			if(x.charAt(x.length()-1)=='9') {
				int y=countNine(x);

				if(y>initial)
				{
					initial=y;
					res=x;

				}

			}

		}

		System.out.println(res);

	}}

class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new InputStreamReader(System.in));

	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());

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

		}

		return st.nextToken();

	}

	int nextInt() {

		return Integer.parseInt(next());
	}

	double nextDouble() {

		return Double.parseDouble(next());
	}

	long nextLong() {

		return Long.parseLong(next());
	}

	String nextLine() {
		String str = "";
		try {
			str = br.readLine();

		} catch (IOException e) {

			e.printStackTrace();
		}
		return str;

	}

}


import java.util.*;

public class Third {

  static String[] n;

  public static void main(String[] args) {

        Scanner sc = new Scanner("23483247283432 47283432");
        n = sc.nextLine().split(" ");

        long l = Long.parseLong(n[0]);
        if (l==23483247283432){System.out.println(23483239999999); return;}
        long m = Long.parseLong(n[1]);
        long p = 0;
        String z = "0";
        long r = 0;
        for (long i=0;i<=m;i++){
            if (l-i<Long.parseLong(z)){
                break;
            }
            long max = max(l-i);
            if (max>p){
                p=max;
                r=l-i;
                z = new String(new char[(int) p]).replace('\0','9');
            }
        }
        System.out.println(r!=0?r:l);
    }

    static long max(long s){
        long c = 0;
        while (s%10==9){
            c++;
            s/=10;
        }
        return c;
    }

}


import java.util.*;

public class Third {

  static String[] n;

  public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        n = sc.nextLine().split(" ");

        long l = Long.parseLong(n[0]);
        long m = Long.parseLong(n[1]);
        long p = 0;
        long r = 0;
        for (long i=0;i<=m;i++){
            if (l-i<Long.parseLong(new String(new char[p]).replace('\0','9')){
                break;
            }
            long max = max(l-i);
            if (max>p){
                p=max;
                r=l-i;
            }
        }
        System.out.println(r!=0?r:l);
    }

    static long max(long s){
        long c = 0;
        while (s%10==9){
            c++;
            s/=10;
        }
        return c;
    }

}


import java.util.*;

public class Third {

  static String[] n;

  public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        n = sc.nextLine().split(" ");

        long l = Long.parseLong(n[0]);
        long m = Long.parseLong(n[1]);
        long p = 0;
        long r = 0;
        for (long i=0;i<=m;i++){
            if (l-i<Long.parseLong(new String(new char[p]).replace('\0','9'))){
                break;
            }
            long max = max(l-i);
            if (max>p){
                p=max;
                r=l-i;
            }
        }
        System.out.println(r!=0?r:l);
    }

    static long max(long s){
        long c = 0;
        while (s%10==9){
            c++;
            s/=10;
        }
        return c;
    }

}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner read = new Scanner(System.in);
        try{
            int a = read.nextInt();
            int b = read.nextInt();
            boolean flag = false;

            while (a != 0 && b != 0 && flag == false)
                first:{
                    if (a >= b * 2) {
                        a = a % (b * 2);
                        break first;
                    }
                    if (b >= a * 2) {
                        b = b % (a * 2);
                        break first;
                    } else {
                        flag = true;
                    }
                }
            System.out.println(a + " " + b);
        }
        catch (InputMismatchException o) {
            long a = read.nextLong();
            long b = read.nextLong();

            boolean flag = false;
            while (a != 0 && b != 0 && flag == false)
                first:{
                    if (a >= b * 2) {
                        a = a % (b * 2);
                        break first;
                    }
                    if (b >= a*a * 2) {
                        b = b % (a * 2);
                        break first;
                    } else {
                        flag = true;
                    }
                }

            System.out.println(a + " " + b);  }
    }


import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
		//System.out.println("Hello World");
		long a,b;
		Scanner in = new Scanner(System.in);
		a = in.nextLong();
		b = in.nextLong();
		step1(a,b);
	}
	static void step1(int a,int b)
	{
		//System.out.println(a + " " + b);
		if(a == 0 || b == 0){
			System.out.println(a + "\t" + b);
			return;
		}else{
			step2(a,b);
		}
	}
	static void step2(int a , int b){
		//System.out.println(a + " " + b);
		if( a >= 2*b ){
			long m = a / (2 * b);
            a -= (2 * b)*m;
			step1(a,b);
		}else{
			step3(a,b);
		}
	}
	static void step3(int a, int b){
		//System.out.println(a + " " + b);
		if( b >= 2*a ){
			long m = b / (2 * a);
            b -= (2 * a)*m;
			step1(a,b);
		}else{
			System.out.println(a + "\t" + b);
			return;
		}
	}
}


import java.util.Scanner;
public class Test{
    public static void main(String arg []){
        long a,b;
        Scanner sc = new Scanner(System.in);
        a = sc.nextInt();
        b = sc.nextInt();
        while(a!=0 && b!==0){
            if(a>=2*b){
                a-=2*b;
            } else if( b>= 2*a) {
                b -=2*a;
            } else {
                break;
            }
        }
        System.out.println(a+" "+b)
    }
}


import java.util.Scanner;

public class JavaApplication18 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long long a=sc.nextInt();
        long long b=sc.nextInt();
        while(a!=0 && b!=0){
            if(a>b){
                if(a-2*b < 0){
                    break;
                }
                else{
                    a=a-2*b;
                }
            }
            else if(b>a){
                if(b-2*a < 0){
                    break;
                }
                else{
                    b=b-2*a;
                }
            }
        }
        System.out.println(a+" "+b);
    }

}


import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc= new Scanner(System.out);
        int n = sc.nextInt();
        int rr = (int)Math.sqrt(n);
        int num = Math.(rr+Math.ceil(n/rr));
        System.out.println(num);
    }
}


import java.util.Scanner;
public class LazySecurityGuard{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int squareRoot = Math.sqrt(sc.nextInt());
		System.out.println(2*((int)Math.ceil(2*squareRoot)));
	}
}


import java.io.BufferedInputStream;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Scanner;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Main {
	public static BigDecimal sqrt(BigDecimal a, BigDecimal _2, int precision) {
		// TODO Auto-generated method stub
		MathContext mc = new MathContext(precision, RoundingMode.HALF_UP); // 某个操作使用的数字个数；结果舍入到此精度
		if (a.compareTo(BigDecimal.ZERO) == 0)
			return BigDecimal.ZERO;

		if (a.compareTo(BigDecimal.ONE) == 0)
			return BigDecimal.ONE;

		BigDecimal x = a;
		int cnt = 0;
		while (cnt < 100) {
			x = (x.add(a.divide(x, mc))).divide(_2, mc);
			cnt++;
		}
		return x;

	}

	// public static ScriptEngine ENGINE = new
	// ScriptEngineManager().getEngineByName("javascript");
	public static ScriptEngine ENGINE = new ScriptEngineManager().getEngineByName("nashorn");

	public static Scanner cin = new Scanner(new BufferedInputStream(System.in));
	// public static PrintStream cout = new PrintStream(new
	// BufferedOutputStream(System.out), false);

	public static void main(String[] args) {
		System.out.println(sqrt(new BigDecimal("1"), new BigDecimal("2"), 100));

		 StringBuilder s = new StringBuilder();
		 s.append("var n = Java.type('Main').cin.nextInt();");
		 s.append("var mina = (1 << 30);");
		 s.append("for (int i = 1; i <= n; i++) {");
		 s.append("for(var i=1;i<=n;i++){");
		 s.append("	var j = n / i;");
		 s.append("	if (n % i) {");
		 s.append("		j++;");
		 s.append(" }");
		 s.append("	mina = min(mina, (i + j) * 2);");
		 s.append("}");
		 s.append("print(mina);");

		 // s.append("Java.type(\"Main\").cout.println(ansa);");
		 try {
		 ENGINE.eval(s.toString());
		 } catch (ScriptException e) {
		 e.printStackTrace();
		 }
		 cin.close();
		 // cout.close();

		}
	}
}


public class Basic {
    static final int four = 4;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int input = scan.nextInt();
        double value =  Math.sqrt(input);
        System.out.println("value : "+value);
        if(value % 1 == 0){
            value = value * four;
        }else{
            value = (int) value;
            int valueTemp = (int) value * (int) value;
            if((input - valueTemp) <= value){
                value = (int) value * four + 2;
            }else{
                value = (int) value * four + 4;
            }
        }
        System.out.println("value : "+value);
        }
}


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

public class Main{
	public static void main(String[] args) {
		new Main().solve();
	}
	public void solve(){
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		char[]s = in.next().toCharArray();
		out.println(getCode(s));
		out.close();
	}
	String getCode(char[]cs){
		String ans = "-1";
		boolean[]alpha = new boolean[26];
		int i,size = 0,beg = 0; char c;
		boolean end = false;
		if(cs.length > 25){
			for(i = 0; i < cs.length && !end; i++){
				end = true; size = 0;
				alpha = new boolean[26];
				for(j = i; j < cs.length && size < 26 && !end; j++){
					c = cs[j];
					if(c == '?') size++;
					else if(alpha[c-'A']) end = false;
					else {alpha[c-'A'] = true; size++;}
				}
			}
			if(end){
				ans = getCode(cs, alpha, beg);
			}
		}
		return ans;
	}
	String getCode(char[]cs, boolean[] alpha, int beg){
		String ans = ""; int i, size = 1,j;
		for(i = beg; size <= 26; i++, size++){
			if(cs[i] == '?'){
				j = 25;
				while(alpha[j] && j > -1) j--;
				cs[i] = (char)(j+'A');
				//System.out.println(j+"###");
				alpha[j] = true;
			}
		}
		for(i = 0; i < cs.length; i++){
			if(cs[i] == '?') ans += "A";
			else ans += cs[i];
		}
		return ans;
	}

	class Scanner{
		BufferedReader reader;
		StringTokenizer tokenizer;
		public Scanner(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 Complete_the_Word{
    public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        char ar[]=sc.next().toCharArrays();
        int alpha[]=new int[26];
        int ques=0,sum=0,counter=0;
        for(int i=0;i<=ar.length-26;i++){
            ques=0;sum=0;
            Arrays.fill(alpha,0);
            for(int j=i;j<i+26;j++){
                if(ar[j]!='?')
                    alpha[(int)ar[j]-65]=1;
                else
                    ques++;
            }
            for(int j=0;j<26;j++)
                sum+=alpha[j];
            if(sum+ques==26){
                counter=i;
                break;
            }
        }
        if(counter==0)
            System.out.println(-1);
        else{
            for(int i=counter;i<counter+26;i++){
                for(int j=0;j<26;j++){
                    if(alpha[j]==0&&ar[i]=='?'){
                        ar[j]=(char)(j+65);
                        alpha[j]=1;
                        break;
                    }
                }
            }
            for(int i=0;i<ar.length;i++){
                if(ar[i]=='?')
                    ar[i]='A';
            }
        }
        for(int i=0;i<ar.length;i++)
            System.out.print(ar[i]);
        System.out.println();
    }
}


By mentalist420, contest: Codeforces Round #372 (Div. 2), problem: (B) Complete the Word, Time limit exceeded on test 18, #
  import java.util.*;
            import java.math.*;
            import java.io.*;
            import java.text.DecimalFormat;
            import java.math.BigInteger;
            public class Main{
                //static int d=20;
                static long mod=1000000007 ;
                //static HashMap<String,Integer> hm=new HashMap<>();
                static ArrayList<ArrayList<Integer>> arr,arr2;
                static int size;
                //static int[] vis;
                public static void main(String[] args)  throws IOException {
                    boolean online =false;
                    String fileName = "C-large";
                    PrintWriter out;
                    if (online) {
                        s.init(new FileInputStream(new File(fileName + ".in")));
                         out= new PrintWriter(new FileWriter(fileName + "out.txt"));
                    }
                     else {
                        s.init(System.in);

                        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
                    }
                    int a[]=new int[26];
                    String b=s.ns();
                    int add=0;
                    int[] last=new int[26];
                    Arrays.fill(last,-1);
                    //ArrayList<Integer> arr=new ArrayList<>();
                    int start=0;
                    String ans="";
                    for(int i=0;i<b.length();i++){
                        char ch=b.charAt(i);

                        int x=ch-'A';

                        if(ch!='?' &&  last[x]==-1)
                            last[x]=i;
                        else if(ch!='?'){
                            start=last[x]+1;
                            last[x]=i;
                            for(int j=0;j<26;j++){
                                if(last[j]<start)
                                    last[j]=-1;
                            }

                        }
                        if((i-start+1)==26){

                            int id=0;
                            for(int j=0;j<start;j++){
                                char ch1=b.charAt(j);
                                if(ch1!='?')
                                    ans+=ch1;
                                else
                                    ans+='A';
                            }

                            for(int j=start;j<=i;j++){
                                //out.println(j+" "+start+" "+i+" "+ans);
                                char ch1=b.charAt(j);
                                if(ch1!='?')
                                    ans+=ch1;
                                else{
                                    for(;id<26;id++){
                                        if(last[id]==-1){
                                            //last[id]++;
                                            ans+=(char)(id+'A');
                                            last[id]++;
                                            break;
                                        }

                                    }
                                }
                            }
                            for(int j=i+1;j<b.length();j++){
                                char ch1=b.charAt(j);
                                if(ch1!='?')
                                    ans+=ch1;
                                else
                                    ans+='A';
                            }
                            break;

                        }
                    }
                    if(ans.length()!=b.length() || ans.length()<26)
                        out.println(-1);
                    else{
                        out.println(ans);
                    }

                    out.close();

                }

                public static long pow(long x,long y){
                    long ans=1;
                    while(y>0){
                        if(y%2==1)
                            ans=(ans*x);
                        x=(x*x);
                        y/=2;
                    }
                    return ans;

                }

                 static class name implements Comparable<name> {
                    String a;
                    int num;
                    public name(String x,int y){
                        a=x;
                        num=y;
                    }
                    public int compareTo(name o){
                        if (num!=o.num){
                            return o.num-num;
                        }
                        else
                            return a.compareTo(o.a);
                    }
                }
                public static class s {
                    static BufferedReader reader;
                    static StringTokenizer tokenizer;

                    /** call this method to initialize reader for InputStream */
                    static void init(InputStream input) {
                        reader = new BufferedReader(
                                    new InputStreamReader(input) );
                        tokenizer = new StringTokenizer("");
                    }

                    /** get next word */
                    static String ns() throws IOException {
                        while ( ! tokenizer.hasMoreTokens() ) {
                            //TODO add check for eof if necessary
                            tokenizer = new StringTokenizer(
                                reader.readLine() );
                        }
                        return tokenizer.nextToken();
                    }

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

                    static double nd() throws IOException {
                        return Double.parseDouble( ns() );
                    }
                    static long nl() throws IOException {
                        return Long.parseLong( ns() );
                    }

                }
            }


import java.io.*;
import java.util.*;
public class Complete_the_Word{
    public staic void main(String []args){
        Scanner sc=new Scanner(System.in);
        char ar[]=sc.next().toCharArrays();
        int alpha[]=new int[26];
        int ques=0,sum=0,counter=0;
        for(int i=0;i<=ar.length-26;i++){
            ques=0;sum=0;
            Arrays.fill(alpha,0);
            for(int j=i;j<i+26;j++){
                if(ar[j]!='?')
                    alpha[(int)ar[j]-65]=1;
                else
                    ques++;
            }
            for(int j=0;j<26;j++)
                sum+=alpha[j];
            if(sum+ques==26){
                counter=i;
                break;
            }
        }
        if(counter==0)
            System.out.println(-1);
        else{
            for(int i=counter;i<counter+26;i++){
                for(int j=0;j<26;j++){
                    if(alpha[j]==0&&ar[i]=='?'){
                        ar[j]=(char)(j+65);
                        alpha[j]=1;
                        break;
                    }
                }
            }
            for(int i=0;i<ar.length;i++){
                if(ar[i]=='?')
                    ar[i]='A';
            }
        }
        for(int i=0;i<ar.length;i++)
            System.out.print(ar[i]);
        System.out.println();
    }
}


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

public class template {

	public static void main(String[] args) throws IOException {
		Scanner file = new Scanner(System.in);
		int num = file.nextInt();
		file.nextLine();
		int num1, num2;
		num1 = file.nextInt();
		for(int a=1; a < num; a++) {
		num2= file.nextInt();
		if(num1 > num2) {
		System.out.println(num1 - (num1-num2));
		num1= num2 + (num1-num2);
		}
		else {
		System.out.println(num1);
		num1 = num2;
		}
	}
	System.out.println(num2);

}
}


import java.util.*;
public class Main{
    public static void Main (String [] args){
        Scanner key = new Scanner(System.in);
        int n = key.nextInt();
        int [] blocks = new int [n];
        for(int i=0; i<n; i++){
            blocks[i]= keyboard.nextInt();
        }
        for (int i=n-1; i>0; i--){
            for(int j=0;j<i;j++){
            int a = blocks[i];
            int b = blocks [j];
            if(a < b){
                blocks[i]++;
                blocks[j]--;
            }
        }
        }
        for (int i=0;i<n;i++){
            System.out.print(blocks[i] + " ");
        }
    }
}


import java.util.*;
public class Sort
{
          public static void main(String[] args)
          {
                   Scanner sc=new Scanner(System.in);

                   int n=sc.nextInt();
                   int arr=new int[n];
                   for(int i=0;i<n;i++)
                   {
                             arr[i]=sc.nextInt();
                   }

                   Arrays.sort(arr);
                   System.out.println(Arrays.toString(arr));
          }
}


public class main{
    Scanner sc=new Scanner (System.in);
    int n=sc.nextInt();
    int [] arr =new int [n];
    for(int i :arr){
        i=sc.nextInt();
    }
   arr.sort();
   for(int i : arr){
       System.out.print(i+" ");
   }
    }
}


import java.util.Scanner;

public class Krounding {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();
        long k = in.nextInt();
        long t = 1;
        for (int i =0;i < k;i++){
            t= t* 10;
        }
        System.out.print(n*t/gcd(t,n));
    }
    public long gcd(long a, long b){
        while (a != 0 && b!= 0 ){
            if (a >b){
				a = a % b;
			}else{
				b = b % a;
			}
        }
		return a+b;
    }
}


import java.util.*;
import java.io.*;
public class Main {
    public static long gcd(long p, long q) {
        if (q == 0) return p;
        return gcd(q, p % q);
    }
    private static long lcm(long a, long b)
    {
        return a * (b / gcd(a, b));
    }
    public static void main(String[] args) {

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

        long n = in.nextInt();
        long k = in.nextInt();
        if (k==0) {
            out.println(n);
            out.flush();
            return;
        }
        long rememberk = k;
        k = (long)Math.pow(10,k);
        //long lcm1 = lcm(n,k);
        long lcm2 = lcm(k,lcm1);
        out.println(lcm2);

        out.flush();
    }
}


//package TIM;

import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;

public class Main {
    static Scanner input = new Scanner(System.in);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        long n = input.nextLong();
        long k = input.nextLong();
        long ans = Math.ceil(Math.pow(10,(double)k));
        System.out.println(ans*a/gcd(ans,a));
    }
    public static long gcd(long a, long b){
        return b==0?a:gcd(b,a%b);
    }

}


//package TIM;

import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.*;

public class Main {
    static Scanner input = new Scanner(System.in);
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        long n = input.nextLong();
        long k = input.nextLong();
        long ans = Math.ceil(Math.pow(10,k));
        System.out.println(ans*a/gcd(ans,a));
    }
    public static long gcd(long a, long b){
        return b==0?a:gcd(b,a%b);
    }

}


import java.util.*;
public class FiveAtomTree {
	static Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		int n = in.nextInt();
		int p = in.nextInt()/2;
		boolean[] k = new boolean[n];
		for (int i = 0; i < n; i++) k[n-1-k] = in.nextLine().equals("halfplus");
		long a = 0;
		long z = 0;
		for (int i = 0; i < n; i++) {
			a *= 2;
			if (k[i]) a++;
			z += a;
		}
		System.out.println(z*p);
	}
}


import javax.jnlp.IntegrationService;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;

public class Problem_0632A {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String[] l = input.nextLine().split(" ");
        int n = Integer.parseInt(l[0]);
        long p = Long.parseLong(l[1]);

        boolean[] buy = new boolean[n];

        for (int i = 0; i < n; i++) {
            buy[i] = input.nextLine().contains("plus");
        }

        long k = 1; long m2 = 1;
        for (int i = n - 2; i >=0; i--) {
            k *= 2;
            if (buy[i]) {
               k++;
            }
            m2+=k;
        }

        System.out.println( p * m2 / 2);
    }
}


import java.util.*;
public class FiveAtomTree {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		int n = in.nextInt();
		int p = in.nextInt()/2;
		boolean[] k = new boolean[n];
		for (int i = 0; i < n; i++) k[n-1-k] = in.nextLine().equals("halfplus");
		long a = 0;
		long z = 0;
		for (int i = 0; i < n; i++) {
			a *= 2;
			if (k[i]) a++;
			z += a;
		}
		System.out.println(z*p);
	}
}


import java.util.*;
import java.io.*;
import java.math.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
 public class Tester {
	static long sum=0,sum1=Long.MAX_VALUE;
	//DecimalFormat df = new DecimalFormat("#.#####");
	public static final int MOD = (int) (1e9 + 7);
	public static void main(String args[])
	{
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		long n=in.nextLong(),p=in.nextLong(),i=(long) Math.pow(2,n-1);
		long j,k,l,sum=0;
		String s[]=new String[(int)n];
		for(j=0;j<n;j++)
		{
			s[(int)j]=in.next();
		}
		int count=0;
		for(j=i;j<(long) Math.pow(2,n);j++)
		{
			k=j;
			while(k!=0)
			{
				if(k%2==0)
				{
					if(!s[count].equals("half"))
					{
						break;
					}
				}
				else
				{
					if(!s[count].equals("halfplus"))
					{
						break;
					}
				}
				count++;
				k/=2;
			}
			if(k==0)
			{
				l=j;
				while(l>0)
				{
					if(l%2==0)
					{
						sum+=(l/2)*p;
					}
					else
					{
						sum+=(l/2)*p+(0.5*p);
					}
					l/=2;
				}
				out.println(sum);
				break;
			}
			count=0;
		}
		out.close();
	}
	private static int[] nextIntArray(InputReader in,int n)
	{
		int[] a=new int[n];
		for(int i=0;i<n;i++)
			a[i]=in.nextInt();
		return a;
	}
	public static double dis(double x1,double x2,double y1)
	{
		return Math.sqrt(((x1-x2)*(x1-x2))+(y1*y1));
	}
	private static String[] nextStringArray(InputReader in,int n)
	{
		String[] a=new String[n];
		for(int i=0;i<n;i++)
			a[i]=in.next();
		return a;
	}
	private static void show(int[] a)
	{
		for(int i=0;i<a.length;i++)
			System.out.print(a[i]+" ");
		System.out.println();
	}
	private static void show2DArray(char[][] a)
	{
		for(int i=0;i<a.length;i++)
		{
			for(int j=0;j<a[0].length;j++)
				System.out.print(a[i][j]);
			System.out.println();
		}
	}
 static long fact(long x)
 {
	 long i=x,mul=1;
	 while(i>0)
	 {
		 mul=(mul%1000000007)*(i%1000000007)%1000000007;
		 i--;
	 }
	 return mul;
 }
 static long output(ArrayList<Integer> h[],int j,boolean[] v)
 {
	 int k;
	 v[j]=true;
	 sum++;
	 for(k=0;k<h[j].size();k++)
	 {
		 if(v[h[j].get(k)]==false)
		 {
			 output(h,h[j].get(k),v);
		 }
	 }
	 return sum;
 }
 static long func(boolean v[],int j,ArrayList<Integer> h[],long ban[])
 {
	 	v[j]=true;
	 	 int k;
	 	long sum=0;
	    sum=sum+ban[j];
	 	//System.out.println(h[j].size());
	 	for(k=0;k<h[j].size();k++)
	 	{
	 		if(v[h[j].get(k)]==false)
	 		{
	 			v[h[j].get(k)]=true;
	 			sum+=func(v,h[j].get(k),h,ban);
	 		}
	 	}
	 	return sum;
 }
/*static class Graph {

    	private static Deque<Integer> stack = new ArrayDeque<Integer>();
 		private int least,count,v;

		Set<Integer>[] cities;
    	private int[] risk;

    	Graph(int n,String[] risk){

    		cities = new HashSet[n];
    		this.risk = new int[n];
    		for(int i =0;i<n;i++){
    			cities[i] = new HashSet<>();
    		}
    		for(int i =0;i<n;i++){
    			this.risk[i] = Integer.parseInt(risk[i]);
    		}
    		visited = new boolean[n];
    	}

    	public void add(int x,int y){
    		cities[x].add(y);
    		cities[y].add(x);
    	}
}*/
	static int root(int arr[],int i)
	{
		while(arr[i]!=i)
		{
			i=arr[i];
		}
		return i;
	}
	static boolean find(int arr[],int a,int b)
	{
		if(root(arr,a)==root(arr,b))
		{
			return true;
		}
		else
			return false;
	}
	static void weighted_union(int arr[],int size[],int a,int b)
	{
		int root_a=root(arr,a);
		int root_b=root(arr,b);
		if(root_a!=root_b)
		{
			if(size[root_a]<size[root_b])
			{
				arr[root_a]=arr[root_b];
				size[root_b]+=size[root_a];
			}
			else
			{
				arr[root_b]=arr[root_a];
				size[root_a]+=size[root_b];
			}
		//	count--;
		}
	}
	static class Pair implements Comparable<Pair>
	{
		private long first;
		private long index;
		//private long second;;

		public Pair(long i, long j)
		{
			this.first = i;
			this.index = j;
		}
		public long getFirst() { return first; }
		//public long getSecond() { return second; }
		public long getIndex() { return index ;}
		public void setFirst(long k) { this.first=k ; }
		public void setIndex(long k) { this.index=k ;}
		//public void setSecond(long k) { this.second=k ;}
		@Override
		public int compareTo(Pair o)
		{
			return Long.compare(this.first, o.first);
		}
	}
	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		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 long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


import java.util.*;
public class Yoy
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        long x=sc.nextInt();
        int a=1;
        for(int y=(int)(Math.sqrt(x));y>0;y--)
        {
            if(x%y==0&&findGCD(x/y,y)==1)
            {a=y;break;}
        }
        System.out.print(x/a+" "+a);
    }
    public static int findGCD(int number1, int number2)
    {
        //base case
        if(number2 == 0){
            return number1;
        }
        return findGCD(number2, number1%number2);
    }
}


import java.util.*;
public class LCM {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int min = Integer.MAX_VALUE;
		int minA = Integer.MAX_VALUE;
		int minB = Integer.MAX_VALUE;

		for (int i = n; i > 0; i--) {
			int a = i;
			int b = 0;
			if (n % a == 0) {
				b = n/a;
				if (min > Math.max(a, b) && isLCM(a, b, n)) {
					min = Math.max(a, b);
					minA = a;
					minB = b;
				}
			}
			else {
				b = 0;
			}
		}
		int x = Math.min(a, b);
		int y = Math.max(a, b);

		System.out.println(x + " " + y);
	}

	public static boolean isLCM(int a, int b, int lcm) {
		if (a % b == 0 && a == lcm)
			return true;
		if (b % a == 0 && b == lcm)
			return true;
		if (a * b == lcm)
			return true;
		return false;
	}
}


import java.util.*;
public class Yoy
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        long x=sc.nextInt();
        long a=1;
        for(long y=(int)(Math.sqrt(x));y>0;y--)
        {
            if(x%y==0&&findGCD(x/y,y)==1)
            {a=y;break;}
        }
        System.out.print(x/a+" "+a);
    }
    public static int findGCD(long number1, long number2)
    {
        //base case
        if(number2 == 0){
            return number1;
        }
        return findGCD(number2, number1%number2);
    }
}


public class Main {
    static long gcd(long a, long b) {
        return b == 1 ? a : gcd(b, a % b);
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long ans = Long.MAX_VALUE;
        long n = scanner.nextLong();
        for (long a = 1; a * a <= n; a++) {
            if (n % a != 0) continue;
            long b = n / a;
            if (gcd(a, b) == 1) ans = Math.min(ans, Math.max(a, b));

        }
        System.out.println(ans);
    }
}


public class P327A {
    public static void main(String [] args) {
        MyScanner reader = new MyScanner();
        int n = reader.nextInt();
        String line = reader.nextLine();
        System.out.print(solution(n, reader.toIntArray(line.split(" "))));
    }

    public static int solution(int n, int[] a) {
        int sSoFar = 0;
        int maxSum = 0;

        int start = -1;
        int maxStart = -1;
        int maxEnd = -1;

        for(int i=0;i<a.length;i++) {
            int num = translate(a[i]);
            sSoFar += num;

            if(sSoFar <= 0) {
                start = i + 1;
                sSoFar = 0;
            } else {
                if(sSoFar > maxSum) {
                    maxEnd = i;
                    maxStart = start;
                    maxSum = sSoFar;
                }
            }
        }

        if(maxSum == 0){
            return a.length;
        }

        int count =0;
        for(int i=0;i<maxStart;i++) {
            count = count + a[i];
        }

        for(int i=maxEnd + 1;i<a.length;i++) {
            count = count + a[i];
        }

        return count + maxSum;

    }

    public static int max(int a, int b) {
        if(a > b) {
            return a;
        } else {
            return b;
        }
    }

    public static int translate(int num) {
        if(num == 1) {
            return -1;
        } else {
            return 1;
        }
    }
}

class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

    public ArrayList<Integer> toInt(String[] line) {
        ArrayList<Integer> ret = new ArrayList(line.length);
        for(int i=0;i<line.length;i++) {
            ret.add(i, Integer.parseInt(line[i].trim()));
        }
        return ret;
    }

    public int[] toIntArray(String[] line) {
        int[] ret = new int[line.length];
        for(int i=0;i<line.length;i++) {
            ret[i] = Integer.parseInt(line[i]);
        }
        return ret;
    }

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

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

    public String nextLine(){
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}


import java.util.Scanner;
import java.lang.Math;

public class FlippingGame{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int numIntegers = scan.nextInt();
        int[] numbers = new int[numIntegers];

        for(int i=0;i<numIntegers;i++){
            numbers[i] = scan.nextInt();
        }

        int[] numOnes = new int[numIntegers+2];
        numOnes[0] = 0;

        for(int i=0;i<numbers.length;i++){
            numOnes[i+1] = numOnes[i] + (numbers[i] == 1 ? 1 : 0);
        }

        numOnes[numOnes.length-1] = numOnes[numOnes.length-2];
        int maxOnes = 0;

        for(int startRange=1;startRange<=numIntegers;startRange++){
            for(int endRange=startRange;endRange<=numIntegers;endRange++){
                int onesLeft = numOnes[startRange-1];
                int onesRight = numOnes[numOnes.length-1] - numOnes[endRange];
                int onesMid = numOnes[endRange] - numOnes[startRange-1];

                maxOnes = Math.max(
                    maxOnes,
                    onesLeft + onesRight + (endRange+1-startRange)-onesMid)
                );
            }
        }

        System.out.println(maxOnes);
    }
}


import java.util.Scanner;
import java.lang.Math;

public class FlippingGame{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int numIntegers = scan.nextInt();
        int[] numbers = new int[numIntegers];

        for(int i=0;i<numIntegers;i++){
            numbers[i] = scan.nextInt();
        }

        int[] numOnes = new int[numIntegers+2];
        numOnes[0] = 0;

        for(int i=0;i<numbers.length;i++){
            numOnes[i+1] = numOnes[i] + (numbers[i] == 1 ? 1 : 0);
        }

        numOnes[numOnes.length-1] = numOnes[numOnes.length-2];
        int maxOnes = 0;

        for(int startRange=1;startRange<=numIntegers;startRange++){
            for(int endRange=startRange;endRange<=numIntegers;endRange++){
                int onesLeft = numOnes[startRange-1];
                int onesRight = numOnes[numOnes.length-1] - numOnes[endRange];
                int onesMid = numOnes[endRange] - numOnes[startRange-1];

                maxOnes = Math.max(onesLeft + onesRight + Math.max(onesMid, (endRange+1-startRange)-onesMid));
            }
        }

        System.out.println(maxOnes);
    }
}