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

public class CF {

	void solve() {
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = in.nextInt();
		int t = in.nextInt();
		Arrays.sort(a);
		int max1 = 0;
		for (int i = 0; i <n ;i++) {
			int maxId = i;
			while (maxId < n && a[maxId] - a[i] <= t)
				maxId++;
			max1 = Math.max(maxId - i, max1);
		}
		out.println(max1);
	}

	FastScaner in;
	PrintWriter out;

	void run() {
		in = new FastScaner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	void runWithFiles() {
		in = new FastScaner(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		solve();

		out.close();
	}

	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		new CF().run();
	}

	class FastScaner {
		BufferedReader br;
		StringTokenizer st;

		FastScaner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

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

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

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

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

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


import java.util.*;
public class B80 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String time = in.nextLine();
        Float h = new Float(time.substring(0, 2));
        Float m = new Float(time.substring(3, 5));
        h %= 12;
        m *= 6;
        h *= 30;
        h += m/12;
        System.out.print(h);
        System.out.print(" ");
        System.out.print(m);
    }
}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class A {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt();
        int d = scanner.nextInt();
        int[] array = new int[n];
        for(int i = 0 ; i < n ; i ++){
            array[i] = scanner.nextInt();
        }
        Arrays.sort(array);

        int[][] dp = new int[n][n];
        numberRemove(array,0,n-1,d,dp);
        System.out.println(dp[0][n-1]);
    }
    public static int numberRemove(int[] array, int l, int r, int d, int[][] dp){
        if(l == r){
            return 0;
        }
        if(array[r] - array[l] <= d){
            return 0;
        }
        if(dp[l][r] > 0){
            return dp[l][r];
        }
        int min = Math.min(numberRemove(array,l+1,r,d,dp), numberRemove(array,l,r-1,d,dp));
        dp[l][r] = min+1;
        return min+1;
    }

}


/*
 * Code Author: Sanket Udgirkar.
 * DA-IICT
 */
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Tester
{
    public static void main(String[] args)
    {
        //InputReader s=new InputReader(System.in);
        //OutputStream outputStream = System.out;

        Scanner s = new Scanner(System.in);

        BigInteger t=s.nextBigInteger();
        BigInteger w=s.nextBigInteger();
        BigInteger b=s.nextBigInteger();

        if(w.compareTo(b)==0)
            System.out.println("1/1");
        else
        {
            BigInteger lcm = w.multiply(b).divide(w.gcd(b));
            BigInteger min=w.min(b).subtract(BigInteger.ONE);
            BigInteger sr = t.remainder(lcm);
            BigInteger ans = t.divide(lcm).multiply(min.add(BigInteger.ONE)).add(min.min(sr));

            BigInteger gcd = ans.gcd(t);
            System.out.printf("%d/%d\n",ans.divide(gcd),t.divide(gcd));
        }
    }

    public static long mod=(long)1e9+7;

    static BigInteger gcd(BigInteger a,BigInteger b)
    {
        if(b.longValue()==0)
            return a;
        a=a.mod(b);
        return gcd(b,a);
    }

    static long exp(long a, long b)
    {
        if(b==0)
            return 1;
        if(b==1)
            return a;
        if(b==2)
            return a*a;

        if(b%2==0)
            return exp(exp(a,b/2),2);
        else
            return a*exp(exp(a,(b-1)/2),2);
    }

    static void quicksort(int arr[],int low, int high)
    {
        int i=low;
        int j=high;
        int pivot=arr[(high+low)/2];
        int temp;

        while(i<=j)
        {
            while(arr[i]<pivot)
                i++;
            while(arr[j]>pivot)
                j--;

            if(i<=j)
            {
                temp=arr[i];
                arr[i]=arr[j];
                arr[j]=temp;

                i++;
                j--;
            }
        }

        if(low<j)
            quicksort(arr, low, j);
        if(i<high)
            quicksort(arr, i, high);
    }

    static class Pair implements Comparable<Pair>
    {
        long x,f;
        Pair(long ii, long cc)
        {
            x=ii;
            f=cc;
        }

        public int compareTo(Pair o)
        {
            return Long.compare(this.x, o.x);
        }

    }

    public 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 CF_320A
{
	public static void main(String args[])
	{
		Scanner scan = new Scanner(System.in);
		String str;
		str = scan.nextLine();
		scan.close();

		System.out.println(Answer(str));

	}

	public static String Answer(String str)
	{
		int counter=0;
		for(int i=0;i<str.length();i++)
		{
			//System.out.printf("%d, value = %s\n", i, str.charAt(i));
			if(str.charAt(i) == '1'){counter=0;continue;}
			else if(str.charAt(i) == '4' && counter<2&& i>0){counter++; continue; }
			else return "NO";
		}
		return "YES";
	}
}


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

public class Main {
    public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353;
    public static void main(String args[]){
        try {
            PrintWriter o = new PrintWriter(System.out);
            boolean multiTest = false;
            // init
            if(multiTest) {
                int t = fReader.nextInt(), loop = 0;
                while (loop < t) {loop++;solve(o);}
            } else solve(o);
            o.close();
        } catch (Exception e) {e.printStackTrace();}
    }
    static void solve(PrintWriter o) {
        try {
            int k = fReader.nextInt();
            // 3,5,7,...
            // 8,12,16,...
            long l = 3, r = 1l<<60;
            while(l < r) {
                long mid = l+(r-l)/2;
                if(check(mid, k)) r = mid;
                else l = mid+1;
            }
            o.println(r);
        } catch (Exception e){e.printStackTrace();}
    }
    static boolean check(long mx, int k) {
        long cnt = 0;
        cnt += (mx+1)/2-1;
        cnt += Math.max(0, mx/4-1);
        return cnt >= k;
    }
    public static int upper_bound(List<Integer> a, int val){
        int l = 0, r = a.size();
        while(l < r){
            int mid = l + (r - l) / 2;
            if(a.get(mid) <= val) l = mid + 1;
            else r = mid;
        }
        return l;
    }
    public static int lower_bound(List<Integer> a, int val){
        int l = 0, r = a.size();
        while(l < r){
            int mid = l + (r - l) / 2;
            if(a.get(mid) < val) l = mid + 1;
            else r = mid;
        }
        return l;
    }
    public static long gcd(long a, long b){
        return b == 0 ? a : gcd(b, a%b);
    }
    public static long lcm(long a, long b){
        return a / gcd(a,b)*b;
    }
    public static boolean isPrime(long x){
        boolean ok = true;
        for(long i=2;i<=Math.sqrt(x);i++){
            if(x % i == 0){
                ok = false;
                break;
            }
        }
        return ok;
    }
    public static void reverse(int[] array){
        reverse(array, 0 , array.length-1);
    }
    public static void reverse(int[] array, int left, int right) {
        if (array != null) {
            int i = left;
            for(int j = right; j > i; ++i) {
                int tmp = array[j];
                array[j] = array[i];
                array[i] = tmp;
                --j;
            }
        }
    }
    public static long qpow(long a, long n){
        long ret = 1l;
        while(n > 0){
            if((n & 1) == 1){
                ret = ret * a % mod;
            }
            n >>= 1;
            a = a * a % mod;
        }
        return ret;
    }
    public static class DSU {
        int[] parent;
        int[] size;
        int n;
        public DSU(int n){
            this.n = n;
            parent = new int[n];
            size = new int[n];
            for(int i=0;i<n;i++){
                parent[i] = i;
                size[i] = 1;
            }
        }
        public int find(int p){
            while(parent[p] != p){
                parent[p] = parent[parent[p]];
                p = parent[p];
            }
            return p;
        }
        public void union(int p, int q){
            int root_p = find(p);
            int root_q = find(q);
            if(root_p == root_q) return;
            if(size[root_p] >= size[root_q]){
                parent[root_q] = root_p;
                size[root_p] += size[root_q];
                size[root_q] = 0;
            }
            else{
                parent[root_p] = root_q;
                size[root_q] += size[root_p];
                size[root_p] = 0;
            }
            n--;
        }
        public int getTotalComNum(){
            return n;
        }
        public int getSize(int i){
            return size[find(i)];
        }
    }
    public static class FenWick {
        int n;
        long[] tree;
        public FenWick(int n){
            this.n = n;
            tree = new long[n+1];
        }
        private void add(int x, long val){
            while(x <= n){
                tree[x] += val;
                x += x&-x;
            }
        }
        private long query(int x){
            long ret = 0l;
            while(x > 0){
                ret += tree[x];
                x -= x&-x;
            }
            return ret;
        }
    }
    public static class Node implements Comparable<Node> {
        Long fst;
        Integer snd;
        public Node(Long fst, Integer snd) {
            this.fst = fst;
            this.snd = snd;
        }
        @Override
        public int hashCode() {
            int prime = 31, res = 1;
            res = prime*res + fst.hashCode();
            res = prime*res + snd.hashCode();
            return res;
        }
        @Override
        public boolean equals(Object obj) {
            if(obj instanceof Node) {
                return fst.equals(((Node) obj).fst) && snd.equals(((Node) obj).snd);
            }
            return false;
        }
        @Override
        public int compareTo(Node node) {
            int result = Long.compare(fst, node.fst);
            return result == 0 ? Integer.compare(snd, node.snd) : result;
        }
    }
    public static class fReader {
        private static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        private static StringTokenizer tokenizer = new StringTokenizer("");
        private static String next() throws IOException{
            while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(reader.readLine());}
            return tokenizer.nextToken();
        }
        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 char nextChar() throws IOException {return next().toCharArray()[0];}
        public static String nextString() throws IOException {return next();}
        public static String nextLine() throws IOException {return reader.readLine();}
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

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

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

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        List<String>A=new ArrayList<String>();
        List<String>C=new ArrayList<String>();
        for (int i = 0; i < 10; ++i) {
            A.add(br.readLine());
        }
        for (int i = 0; i < 10; i++) {
            C.add(A.get(i));
        }
        String help;
        for (int i = 0; i < 10; ++i) {
            help="";
            for (int j = 0; j < 10; ++j) {
                help+=A.get(j).charAt(i);
            }
            C.add(help);
        }
       String one="XXXX.";
       String two=".XXXX";
       String three="XXX.X";
       String four="XX.XX";
       String five="X.XXX";
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                //start row i col j
                help="";
                help+=A.get(i).charAt(j);
                for (int l=j+1, m = i+1; m < 10; ++m,++l) {
                    if(m==10||l==10)
                        break;
                    help+=A.get(m).charAt(l);
                }
                C.add(help);
            }
        }
        for (int i = 0; i < 10; ++i) {
            for (int j = 0; j < 10; ++j) {
                //start row i col j
                help="";
                help+=A.get(i).charAt(j);
                for (int l=j-1, m = i+1; m <10; ++m,--l) {
                    if(m==10||l==-1)
                        break;
                    help+=A.get(m).charAt(l);
                }
                C.add(help);
            }
        }
        for (int i = 0; i < C.size(); ++i) {
            if(C.get(i).contains(one)||C.get(i).contains(two)||C.get(i).contains(three)||C.get(i).contains(four)||C.get(i).contains(five)){
            System.out.println("YES");System.exit(0);
            }

        }
        System.out.println("NO");
    }

}


import java.util.Scanner;
public class main{
    public static void main(String[] args){
    Scanner s=new Scanner(System.in);
String str="",str2="";
String k=s.next();
 String k2="CODEFORCES";
   String tmp=k2,tmp2=k;

   for(int i=tmp.length();i>=0;i--)
   {
       tmp=tmp.substring(0, i);
       if(tmp2.startsWith(tmp))
       {
          tmp2=tmp2.replaceFirst(tmp,"");
           k2=k2.replaceFirst(tmp,"");
         for(int j=0;j<tmp2.length()-k2.length();j++)
          str2+=tmp2.charAt(j);
           k=k.replaceFirst(str2,"");
           break;
       }
   }
        if(k.equalsIgnoreCase("CODEFORCES"))
            System.out.println("YES");
        else
            System.out.println("NO");

 }
}


import java.util.*;

/**
 * Created by AdminPC on 06.02.2017.
 */
public class Codeforces {
    public static final int MOD = 1000000007;
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong(), m = in.nextLong();
        int k = in.nextInt();
        if (k==-1){
            if (n%2!=m%2){
                System.out.println(0);
                return;
            }
        }
        System.out.println(pow(pow(2,n-1), m-1));
    }
    static int pow(long a, long b){
        if (b==0)return 1;
        long result = pow(a, b/2);
        if (b%2==1){
            return (int)(result * result % MOD * a % MOD);
        }
        else return (int)(result * result % MOD);
    }
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner input = new Scanner(System.in);

		//inputs
		long n = input.nextLong();
                if(n == 0)
                    System.out.println(0);
                else if((n + 1) % 2 == 0)
                    System.out.println((n + 1) / 2);
                else
                    System.out.println(n + 1);
	}
}


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;

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long k = in.nextLong();
            long res = 0;

            if (k % 2 == 1) {
                res = 1;
            } else {
                while (k > 0) {
                    int m = twoPow(k);
                    if (k == (Math.pow(2L, m))) {
                        res = m + 1;
                        break;
                    }
                    k -= Math.pow(2L, m - 1);
                }

            }
            out.println(res);
        }

        int twoPow(long k) {
            int res = 0;
            while (Math.pow(2L, res) < k) res++;
            return res;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            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 nextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.util.Scanner;

public class Ivan{

  public static boolean check(long s,long n){
    long big = 0;
    long u = s;
    while (s != 0){
      long amari = s % 10;
      big = big + s % 10;
      s = (s - amari) / 10;
    }
    if (u - big >= n){
      return true;
    }else return false;
  }
  public static void main(String args[]){
      Scanner scan = new Scanner(System.in);
      long s = scan.nextLong();
      long n = scan.nextLong();
      long r =0;
        if ( s > n){
          for (long i = n;i<s+1;i++){
          if (check(i,n)){
            r=i;
            break;
          }else r = s+1;
          }
        System.out.print(s-r+1);
      }else System.out.print("0");
  }
}


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

public class EvenOdds
{
    public static void main(String arg[]) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line[] = br.readLine().split(" ");
        long total = Long.parseLong(line[0]);
        long position = Long.parseLong(line[1]);

        if (total % 2 != 0)
        {
            if (position <= ((total / 2) + 1))
            {
                System.out.println(2 * (position) - 1);
            } else
            {
                System.out.println(2 * (position - ((total / 2) + 1)));
            }
        } else
        {
            if (position <= total / 2)
            {
                System.out.println(2 * (position) - 1);
            } else
            {
                System.out.println(2 * (position - total / 2));
            }
        }
    }
}


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

public class codeforces implements Runnable {

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int t = 1;

		while(t-- > 0) {

			int n = s.nextInt();

			int[] check = new int[10000];

			int[][] val = new int[n][6];

			for(int i = 0; i < n; i++)
				for(int j = 0; j < 6; j++)
					val[i][j] = s.nextInt();

			for(int i = 0; i < n; i++)
				for(int v1 = 0; v1 < 6; v1++)
					check[val[i][v1]] = 1;

			for(int i = 0; i < n; i++) {

				for(int j = 0; j < n; j++) {

					if(i == j)
						continue;

					for(int v1 = 0; v1 < 6; v1++)
						for(int v2 = 0; v2 < 6; v2++)
							check[10 * val[i][v1] + val[j][v2]] = 1;
				}
			}

			for(int i = 0; i < n; i++) {

				for(int j = 0; j < n; j++) {

					if(i == j)
						continue;

					for(int k = 0; k < n; k++) {

						if(i == k || j == k)
							continue;

						for(int v1 = 0; v1 < 6; v1++)
							for(int v2 = 0; v2 < 6; v2++)
								for(int v3 = 0; v3 < 6; v3++)
									check[100 * val[i][v1] + 10 * val[j][v2] + val[k][v3]] = 1;
					}
				}
			}

			int x = 1;

			while(check[x] == 1)
				x++;

			w.println(x - 1);

		}

		w.close();
	}

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

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new codeforces(),"codeforces",1<<26).start();
	}

}


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

public class B {
    public static StreamTokenizer in = new StreamTokenizer(System.in);
    public static boolean bg = true;
    public static long[][] data = null;
    public static long finmin = Long.MAX_VALUE;
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int n1 = Integer.parseInt(scan.next());
        int k1 = Integer.parseInt(scan.next());

        data = new long[n1][];
        for (int i=0;i<n1;i++){
            char[] cur = scan.next().toCharArray();
            long[] cur2 = new long[cur.length];
            for (int j = 0;j<cur2.length;j++){
                cur2[j] = cur[j] - '0';
            }
            data[i] = cur2;
        }

        gen(k1);
        pn(finmin);
    }

    public static void gen(int k1){
        gen(new ArrayList(), new HashSet(), k1);
    }

    public static void gen(ArrayList<Integer> l1, HashSet<Integer> s1, int k1){
        if (l1.size()==k1){
            //pn(l1);
            long max = Long.MIN_VALUE;
            long min = Long.MAX_VALUE;
            for (long[] e: data){
                long cur = 0;
                for (int f: l1){
                    cur *=10;
                    cur += e[f];
                }
                if (cur>max){
                    max = cur;
                }
                if (cur<min){
                    min = cur;
                }
            }
            if (max-min<finmin){
                finmin = max - min;
            }
            //pn(max - min);

        }
        for (int i = 0;i<k1; i++){
            if (!s1.contains(i)){
                l1.add(i);
                s1.add(i);
                gen(l1,s1,k1);
                l1.remove(l1.size()-1);
                s1.remove(i);
            }
        }
    }

    private static int ni() throws Exception {
        in.nextToken();
        return (int) in.nval;
    }

    private static long nl() throws Exception {
        in.nextToken();
        return (long) in.nval;
    }

    private static double nd() throws Exception {
        in.nextToken();
        return in.nval;
    }

    private static void pn(Object o1) {
        System.out.println(o1);
    }
}


// ~/BAU/ACM-ICPC/Teams/A++/BlackBurn95
// ~/sudo apt-get Accpeted

import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder out = new StringBuilder();
        StringTokenizer tk;

        tk = new StringTokenizer(in.readLine());
        BigInteger a = new BigInteger(tk.nextToken()),c = new BigInteger(tk.nextToken());

        String A = a.toString(3),C = c.toString(3) ;

        if(A.length() < C.length()) {
            String tmp = "";
            for(int i=0; i<C.length()-A.length(); i++)
                tmp += "0";
            A = tmp+A;
        } else if(A.length() > C.length()) {
            String tmp = "";
            for(int i=0; i<A.length()-C.length(); i++)
                tmp += "0";
            C = tmp+C;
        }

        char [] B = new char[A.length()];
        for(int i=0; i<A.length(); i++)
            B[i] = (char)((C.charAt(i)-'0'-(A.charAt(i)-'0')+3)%3 + '0');

        BigInteger b = new BigInteger(valueOf(B),3);

        System.out.println(b.toString(10));
    }

}


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

public class P_452A_PokeMon {

	public static void main(String[] args) {
		try {
//			long startTime1 = System.nanoTime();
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			br.readLine();

			String line2Str = br.readLine();

//			long startTime = System.nanoTime();
//			System.out.println("Time Taken: "+(startTime-startTime1)/1000);
			System.out.println(solve(line2Str));
//			long endTime = System.nanoTime();
//			System.out.println("Time Taken: "+(endTime-startTime)/1000);

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

	private static String solve(String str){
		String[] pokemons = {"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"};
		for (int i = 0; i < pokemons.length; i++) {
			boolean found = false;
			if(pokemons[i].length()==str.length()){
				found = true;
				for (int j = 0; j < str.length(); j++) {
					if(str.charAt(j) == '.') continue;
					if(pokemons[i].charAt(j) != str.charAt(j)){
						found = false;
						break;
					}
				}
			}
			if(found){
				return pokemons[i];
			}
		}
		return null;
	}

}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

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

/**
 *
 * @author user
 */
public class bored {
    public static void main(String args[])throws IOException
    {
//       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//       String s=br.readLine();
//       String [] temp=s.split(" ");
        Scanner sc=new Scanner(System.in);
       int a=sc.nextInt();
       int b=sc.nextInt();
       int f=Math.min(a,b);
       int ans=1;
       while(f>0)
       {
           ans*=f;

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

}


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

public class Code83
{

	private static long mod = 1000000007;
	static class InputReader {

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

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

		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}
	}

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static ArrayList<Integer> primeFactorization(int n)
	{
		ArrayList<Integer> a =new ArrayList<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		long m = in.nextLong();
		long start = 1;
		long end = Long.MAX_VALUE-1;
		long result = -1;
		while(start<=end)
		{
			long mid = (start+end)/2;
			long ans = 0 ;
			for(long i=2;(i*i*i)<=mid;i++)
			{
				ans+=(mid/(i*i*i));
			}

			//System.out.println(mid + " " +ans);
			if(ans==m)
			{
				result = mid;
				end = mid-1;
			}

			else if(ans<m)
				start = mid+1;
			else if(ans>m)
				end = mid-1;
		}

		pw.println(result);
		pw.flush();
		pw.close();
	}
}


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

public class Codeforces {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		//int cases = Integer.parseInt(br.readLine());
		//o:while(cases-- > 0) {
			String[] str = br.readLine().split(" ");
			int n = Integer.parseInt(str[0]);
            long mod = Long.parseLong(str[1]);
            long [] dp = new long[n + 1];
            dp[1] = 1;
            long sum = 1;
            for (int i = 2; i <= n; i++) {
                dp[i] = sum;
                // the dp value that some range of numbers takes
                int cur = 1;
                int max = i;
                //System.out.println("==== "+i+" =======");
                while (cur <= i / 2) {
                    int around = i / (cur + 1);
                    int min = -1;
                    for (int j = around + 1; j >= Math.max(1, around - 1); j--) {
                        if (i / j <= cur) {
                            min = j;
                        }else {
                        	break;
                        }
                    }
                    dp[i] = (dp[i] + (dp[cur] * (max - min + 1)) % mod) % mod;
                    //System.out.println(cur+" "+min+" "+max);
                    max = min - 1;
                    cur = i / max;
                }
                sum = (sum + dp[i]) % mod;
            }
            System.out.println(dp[n]);
		//}
	}
}


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

public class TaskD {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;

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

    void run() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        st = null;
        out = new PrintWriter(System.out);
        solve();
        br.close();
        out.close();
    }

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

        dm = new int[1 << 19];
        Arrays.fill(dm, -1);

        for (int i = 0; i < a.length; ++i)
            for (int j = 0; j < a[i].length; ++j)
                a[i][j] -- ;

        int mask = 0;
        for (int t = 0; t < 19; ++t) {
            String str = nextToken();
            if (str.compareTo("O") == 0) mask |= (1 << t) ;;
        }
        int res = brute(mask);
        out.print(res == 1 ? "Karlsson" : "Lillebror");

    }
    int brute(int mask) {
        if (mask == 0) {
            return 0;
        }
        if (dm[mask] != -1) return dm[mask];

        for(int v = 0; v < a.length; ++v) {

            for (int i = 0; i < a[v].length; ++i) {
                for(int j = i; j < a[v].length; ++j) {
                    boolean ok = true;
                    int cm = 0;
                    for (int u = i; ok && u <= j; ++u) {
                        if ((mask & (1 << a[v][u])) == 0) {
                            ok = false;
                        } else cm |= (1 << a[v][u]);

                    }
                    if (ok && cm > 0) {
                            int d = brute(mask ^ cm);
                            if (d == 0) return dm[mask] = 1;
                        }
                }
            }
        }
        return dm[mask] = 0;
    }

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

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

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

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


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

public class practice {
	static 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());
        }

        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;
        }
    }
	static class Print
	{
	    private final BufferedWriter bw;
	    public Print()
	    {
	        bw=new BufferedWriter(new OutputStreamWriter(System.out));
	    }
	    public void print(String str)throws IOException
	    {
	        bw.append(str);
	    }
	    public void println(String str)throws IOException
	    {
	        print(str);
	        bw.append("\n");
	    }
	    public void close()throws IOException
	    {
	        bw.close();
	    }}
		public static void main(String[] args) throws IOException {
			FastReader scn=new FastReader();
			Print p=new Print();
			long n=scn.nextLong(),m=scn.nextLong(),s=scn.nextLong();
			long ans=((n-1)/s+1)*((m-1)/s+1)*((n-1)%s+1)*((m-1)%s+1);
			p.println(Long.toString(ans));

			p.close();

		}
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    int v1=sc.nextInt();
	    int v2=sc.nextInt();
	    int t1=sc.nextInt();
	    int t2=sc.nextInt();
	    int ans1=(n*v1)+(t1+t1);
	    int ans2=(n*v2)+(t2+t2);
	    if(ans1<ans2)
	        {
	            System.out.println("First");
	        }
	        else if(ans1>ans2)
	            {
	                System.out.println("Second");
	            }
	            else if(ans1==ans2)
	            		{
	            			System.out.println("Friendship");
	            		}
	}
}


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

public class InitialBet {

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

		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		String[] strings = reader.readLine().split(" ");
		int c1 = Integer.valueOf(strings[0]);
		int c2 = Integer.valueOf(strings[1]);
		int c3 = Integer.valueOf(strings[2]);
		int c4 = Integer.valueOf(strings[3]);
		int c5 = Integer.valueOf(strings[4]);
		int sum = (c1 + c2 + c3 + c4 + c5);
		if (sum == 0) {
			System.out.println(-1);
			return;
		}
		if (sum % 5 == 0) {
			System.out.println(sum / 5);
		} else {
			System.out.println(-1);
		}
	}
}


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

public class Dominoes {
	public static void main(String[] args) {
		Scanner o = new Scanner(System.in);
		int n = o.nextInt(), m = o.nextInt();
		BigInteger b1 = BigInteger.valueOf(n), b2 = BigInteger.valueOf(m);
		if( n == 1 && m == 1)
			System.out.println(0);
		else if( m == 1 )
			System.out.println(n - 1);
		else
			System.out.println(BigInteger.valueOf(m - 1).multiply(b1));
	}
}


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

public class SquaresAndCubes {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        for (int i = 0; i < t; i++) {
            long n = in.nextLong();
            long a = (long)Math.sqrt(n);
            long b = (long)Math.cbrt(n);
            long c = (long)Math.sqrt(b);
            //System.out.println(a);
            //System.out.println(b);
            //System.out.println(c);
            System.out.println(a+b-c);
        }
    }
}


import java.util.*;
public class B{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n= sc.nextInt();
        int a[]=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=sc.nextInt();
        }
       int c=0;
       Arrays.sort(a);
       int index=0;
       while(checkSum(a,n))
       {
           a[index++]=5;
           c++;
       }
        System.out.println(c);
    }
    static boolean checkSum(int a[],int n){
        float sum=0;
        for(int i=0;i<n;i++)
        {
            sum+=a[i];
        }
       // System.out.println(sum/n);
        return (sum/n)<4.5;
    }
}


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

public class Solver {

    public static void main(String[] Args) throws NumberFormatException,
            IOException {
        new Solver().Run();

    }

    PrintWriter pw;
    StringTokenizer Stok;
    BufferedReader br;

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

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

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

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

    public void Run() throws NumberFormatException, IOException {
        //br = new BufferedReader(new FileReader("input.txt"));
        //pw = new PrintWriter("output.txt");
        br = new BufferedReader(new InputStreamReader(System.in));
        pw = new PrintWriter(new OutputStreamWriter(System.out));
        int x = nextInt(),y = nextInt(),z = nextInt(),xa = nextInt(),ya = nextInt(),za = nextInt(),sum=0;
        int[] a =new int[6];
        for (int i=0; i<6; i++)
            a[i] = nextInt();
        if (y<0)
            sum = sum+a[0];
        if (y>ya)
            sum = sum+a[1];
        if (z<0)
            sum = sum+a[2];
        if (z>za)
            sum = sum+a[3];
        if (x<0)
            sum = sum + a[4];
        if (x>xa)
            sum = sum + a[5];
        pw.print(sum);
        pw.flush();
        pw.close();

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskC {
        int MOD = 998244353;
        int N = 5001;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int[][] dp = new int[N][N];
            for (int i = 0; i < N; ++i) {
                for (int j = 0; j < N; ++j) {
                    if (i == 0 || j == 0) dp[i][j] = 1;
                    else
                        dp[i][j] = (int) MathUtils.addMod(dp[i - 1][j], MathUtils.mulMod(j, dp[i - 1][j - 1], MOD), MOD);
                }
            }
            out.println(MathUtils.mulMod(dp[a][b], MathUtils.mulMod(dp[a][c], dp[b][c], MOD), MOD));
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

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

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class MathUtils {
        public static long addMod(long a, long b, long md) {
            if (a >= md) a -= md;
            if (b >= md) b -= md;
            a += b;
            if (a >= md) a -= md;
            return a;
        }

        public static long mulMod(long a, long b, long md) {
            return a * b % md;
        }

    }
}


import java.util.*;
import java.io.*;
import java.awt.Point;
import static java.lang.Math.*;

public class CF238A {
    static long M = 1000L*1000*1000+9;
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        long n = in.nextInt();
        long m = in.nextInt();
        long p2 = pow(2, m)-1;

        long ans = 1;
        for(int i=0; i<n; i++) {
            ans = (ans*p2)%M;
            p2--;
        }
        System.out.println(ans);
    }
    static long pow(long base, long exp) {
        if(exp == 0) return 1;
        if(exp%2==1) return (base*pow(base, exp-1))%M;
        return pow( (base*base)%M, exp/2);
    }

    public static <T> List<T> list() { return new ArrayList<T>(); }
    public static <K,V> Map<K,V> map() { return new HashMap<K,V>(); }
    public static int i(String s) { return Integer.parseInt(s); }
    public static long l(String s) { return Long.parseLong(s); }
}


import java.util.*;

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

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int b = in.nextInt();

        int[] k = new int[a];
        int[] s = new int[a];

        for (int i = 0; i < a; i++) {
            k[i] = in.nextInt();
        }
        for (int i = 0; i < a; i++) {
            s[i] = in.nextInt();
        }

        List w = new LinkedList();
        List q = new LinkedList();

        for (int i = 1; i < a; i++) {
            w.add(k[i] - k[i - 1]);
            q.add(s[i] - s[i - 1]);
        }

        w.add((b - k[a - 1]) + k[0]);
        q.add((b - s[a - 1]) + s[0]);

        String res = "NO";
        for (int i = 0; i < a; i++) {

            if (w.equals(q)) {
                res = "YES";
                break;
            }
            w.add(w.get(0));
            w.remove(0);

        }

        System.out.println(res);

    }

}


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

public class TwoProblems {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] l = br.readLine().split("\\s+");
        int[] arr = new int[6];
        boolean flag = false;

        for (int i = 0; i < 6; i++)
            arr[i] = Integer.parseInt(l[i]);

        if (arr[0] == 0) {
            System.out.println("YES");

        } else {
            int t = arr[1];
            int x = arr[0];
            for (int i = 0; i < t; i++)
                for (int j = 0; j < t; j++)
                    if (x == ((arr[2] - i * arr[4]) + (arr[3] - j * arr[5]))
                            || x == (arr[2] - i * arr[4])
                            || x == (arr[3] - j * arr[5]))
                        flag = true;

                        if (flag)
                            System.out.println("YES");
                        else
                            System.out.println("NO");
        }

    }

}


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

public class E implements Runnable{
	public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();}

	int MAX = 511, MOD = 998244353, INV = 499122177;

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int n = fs.nextInt();
		int k = fs.nextInt();
		if(n == 1) {
			System.out.println(0);
			return;
		}

		int[][] dp = new int[MAX][MAX];
		dp[1][1] = 2;
		for(int pos = 0; pos < n; pos++) {
			int[][] ndp = new int[MAX][MAX];

			for(int i = 1; i <= Math.min(k, n); i++) {
				for(int j = 1; j <= Math.min(k, n); j++) {
					int nm = Math.max(i, j+1);
					ndp[nm][j+1] = add(ndp[nm][j+1], dp[i][j]);
					ndp[i][1] = add(ndp[i][1], dp[i][j]);

				}
			}
			if(pos != n-1)
				dp = ndp;
		}

		int[] nums = new int[MAX];
		int[] div2 = new int[MAX];
		for(int i = 1; i <= Math.min(n, k); i++) {
			for(int j = 1; j <= Math.min(n, k); j++) {
				nums[i] = add(nums[i], dp[i][j]);
			}
		}
		for(int i = 1; i <= n; i++) div2[i] = mult(nums[i], INV);

		int res = 0;
		for(int i = 1; i <= Math.min(n, k); i++) {
			for(int j = 1; j <= Math.min(n, k); j++) {
				if(i * j < k) {
					res = add(res, mult(2, mult(div2[i], div2[j])));
				}
			}
		}

		out.println(res);
		out.close();
	}

	int mult(int a, int b) {
		long aa = a;
		if(aa >= MOD) aa -= MOD;
		if(b >= MOD) b -= MOD;
		aa *= b;
		if(aa >= MOD) aa %= MOD;
		return (int)aa;
	}

	int add(int a, int b) {
		if(a >= MOD) a -= MOD;
		if(b >= MOD) b -= MOD;
		a += b;
		if(a >= MOD) a-= MOD;
		return a;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}

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

	}

}


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

public class Solution {

    private final static FastReader in = new FastReader();
    private static final PrintWriter out = new PrintWriter(System.out);

    public static long solve(long n) {
        PriorityQueue<Long> store = new PriorityQueue<>(Collections.reverseOrder());
        long i;
        store.add(1L);
        for (i = 2; i * i < n; i++) {
            if (n % i == 0) {
                store.add(i);
                store.add(n / i);
            }
        }
        store.add(n);
        if (i * i == n) {
            store.add(i);
        }
        boolean div = false;
        long max = Integer.MIN_VALUE;
        long a;
        while (!store.isEmpty()) {
            a=store.poll();
            for (i = 2; i * i <= a; i++) {
                if (a % (i * i) == 0) {
                    div = true;
                    break;
                }
            }
            if (!div) {
                return a;
            }
            div = false;
        }
        return max;
    }

    public static void main(String[] args) {
        long n = in.nextLong();
        out.println(solve(n));
        out.close();
    }

    private static final class FastReader {
        private static BufferedReader BF;
        private static StringTokenizer ST;

        public FastReader() {
            BF = new BufferedReader(new InputStreamReader(System.in));
            ST = null;
        }

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

        }

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

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

}


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

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

        int n[][] = new int[5][5];
        int x = 0,y = 0;

        for(int i = 0; i <5; i++)
        {
           for(int j = 0; j <5; j++)
           {
               n[i][j] = input.nextInt();
           }

        }
        for(int i = 0; i <5; i++)
        {
           for(int j = 0; j <5; j++)
           {
               if(n[i][j] == 1)
               {
                   x = i+1; y = j+1;
               }

           }
        }

        int w = Math.abs(x-3)+ Math.abs(y-3);
        System .out.println(w);

    }

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class D_Round_491_Div2 {

    public static long MOD = 1000000007;
    static int[][][] dp;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        String[] data = new String[2];
        for (int i = 0; i < 2; i++) {
            data[i] = in.next();
        }
        int n = data[0].length();
        if (n < 2) {
            out.println(0);
        } else {
            dp = new int[2][2][n];
            for (int[][] a : dp) {
                for (int[] b : a) {
                    Arrays.fill(b, -1);
                }
            }
            out.println(cal(1, get(data[0].charAt(0)), get(data[1].charAt(0)), data));
        }

        out.close();
    }

    static int cal(int index, int a, int b, String[] data) {
        if (index == data[0].length()) {
            return 0;
        }
        if (dp[a][b][index] != -1) {
            return dp[a][b][index];
        }
        int x = get(data[0].charAt(index));
        int y = get(data[1].charAt(index));
        int result = cal(index + 1, x, y, data);
        if (x == 0 && y == 0) {
            if (a == 0 || b == 0) {
                result = Integer.max(result, 1 + cal(index + 1, 1, 1, data));
            }
            if (a == 0 && b == 0) {
                result = Integer.max(result, 1 + cal(index + 1, 0, 1, data));
                result = Integer.max(result, 1 + cal(index + 1, 1, 0, data));
            }
        } else if (x == 0) {
            if (a == 0 && b == 0) {
                result = Integer.max(result, 1 + cal(index + 1, 1, 1, data));
            }
        } else if (y == 0) {
            if (a == 0 && b == 0) {
                result = Integer.max(result, 1 + cal(index + 1, 1, 1, data));
            }
        }
        return dp[a][b][index] = result;
    }

    static int get(char c) {
        if (c == 'X') {
            return 1;
        }
        return 0;
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Integer.compare(x, o.x);
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b, long MOD) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2, MOD);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

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

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

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

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

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.util.*;

public class Problem2 {

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

        Set<Otr> set = new TreeSet<>();

        n = scanner.nextInt();
        for(int i = 0; i <= n; ++i) {
            for(int j = i + 1; j <= n; ++j) {
                set.add(new Otr(i, j));
            }
        }

//        System.out.println(set.size());
//        System.out.println(set);

        Set<Layer> layers = new HashSet<>();

        Iterator<Otr> iter = set.iterator();
        while (iter.hasNext()) {
            Otr otr = iter.next();
            boolean added = false;

            Iterator<Layer> layerIterator = layers.iterator();
            while (layerIterator.hasNext()) {
                Layer layer = layerIterator.next();
                if (layer.add(otr)) {
                    added = true;
                    break;
                }
            }

            if (!added) {
                Layer newLayer = new Layer();
                newLayer.add(otr);
                layers.add(newLayer);
            }
        }

        System.out.println(layers.size());
        //System.out.println(layers);

    }

    public static class Otr implements Comparable<Otr>{
        public int left;
        public int right;

        public Otr(int l, int r) {
            left = l;
            right = r;
        }

        public int len() {
            return right - left;
        }

        @Override
        public String toString() {
            return "[" + left + "," + right + "]";
        }

        @Override
        public int compareTo(Otr o) {
            int len1 = len();
            int len2 = o.len();

            if (len1 != len2) return Integer.compare(len2, len1);

            return Integer.compare(left, o.left);
        }

        public boolean intersect(Otr other) {
            if (left >= other.right) return false;
            if (other.left >= right) return false;

            return true;
        }
    }

    public static class Layer {
        List<Otr> list = new ArrayList<>();

        public boolean add(Otr newOtr) {
            boolean added = true;

            for(Otr otr : list) {
                if (otr.intersect(newOtr)) {
                    added = false;
                    break;
                }
            }

            if (added) {
                list.add(newOtr);
            }

            return added;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("{ ");
            for(Otr otr : list) {
                sb.append(otr);
                sb.append(" , ");

            }

            sb.append("}\n");
            return sb.toString();
        }
    }
}


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

 public class Main {
     static int N, dp[][][], time[], f[], d[], t[], ans[];

     public static void main(String[] args) {
         Scanner input = new Scanner(System.in);
         int x1 = input.nextInt();
         int y1 = input.nextInt();
         int r11 = input.nextInt();
         int r12 = input.nextInt();
         int x2 = input.nextInt();
         int y2 = input.nextInt();
         int r21 = input.nextInt();
         int r22 = input.nextInt();
         int cnt = 0;
         int x,y;
         if(circle(x1,y1,x2,y2,r11,r21,r22)) {
             cnt++;
         }
         if(circle(x1,y1,x2,y2,r12,r21,r22))
             cnt++;
         if(circle(x2,y2,x1,y1,r21,r11,r12))
             cnt++;
         if(circle(x2,y2,x1,y1,r22,r11,r12))
             cnt++;
         System.out.println(cnt);

     }

     static boolean circle(int x1, int y1, int x2,
                       int y2, int r1, int r2,int R2)
     {
         double distSq = Math.sqrt((x1 - x2) * (x1 - x2) +
                 (y1 - y2) * (y1 - y2));
         if ( distSq+r1 <= r2 || distSq+R2 <= r1 || r1+R2 <= distSq )
             return true;
         else return false;
     }

 }


// Change Of Plans BABY.... Change Of Plans //
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class rechableNumbers {
    static Set <Long> set=new HashSet<>();
    static ArrayList<Long> ar=new ArrayList<>();
    static void MainSolution() {
        int x=ni();
        //set.add((long)x);
        dfs(x);
        //pl(set);
        pl(set.size());
    }
    static void dfs(long x){
        if(set.contains(x))return;
        set.add(x);
        x++;
        while(x%10==0)x/=10;
        dfs(x);
    }

    /*----------------------------------------------------------------------------------------------------------------*/
    //THE DON'T CARE ZONE BEGINS HERE...\\
    static int mod9 = 1000000007;
    static int n, m, l, k, t, mod = 998244353;
    static AwesomeInput input = new AwesomeInput(System.in);
    static PrintWriter pw = new PrintWriter(System.out, true);

    static class AwesomeInput {
        private InputStream letsDoIT;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        private AwesomeInput(InputStream incoming) {
            this.letsDoIT = incoming;
        }

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

        private long ForLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        private String ForString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            boolean isSpaceChar(int ch);
        }
    }

    // functions to take input//
    static int ni() {
        return (int) input.ForLong();
    }

    static String ns() {
        return input.ForString();
    }

    static long nl() {
        return input.ForLong();
    }

    static double nd() throws IOException {
        return Double.parseDouble(new BufferedReader(new InputStreamReader(System.in)).readLine());
    }

    //functions to give output
    static void pl() {
        pw.println();
    }

    static void p(Object o) {
        pw.print(o + " ");
    }

    static void pws(Object o) {
        pw.print(o + "");
    }

    static void pl(Object o) {
        pw.println(o);
    }

    public static void main(String[] args) {      //threading has been used to increase the stack size.

        new Thread(null, null, "Vengeance", 1 << 25)  //the last parameter is stack size desired.
        {
            public void run() {
                try {
                    double s = System.currentTimeMillis();
                    MainSolution();
                    //pl(("\nExecution Time : " + ((double) System.currentTimeMillis() - s) / 1000) + " s");
                    pw.flush();
                    pw.close();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
}


import java.util.Scanner;
public class A {
    private void solve() {
        int[] n = {sc.nextInt(),sc.nextInt(),sc.nextInt()};
        int ret = 0;
        while(!isZero(n)) {
            for(int i=0;i<3;i++) {
                n[i]-=2;
                if(isZero(n)) break;
                ret++;
            }
        }
        System.out.println(ret+30);
    }

    private boolean isZero(int[] n) {
        return n[0]<=0&&n[1]<=0&&n[2]<=0;
    }

    private Scanner sc=new Scanner(System.in);
    public static void main(String[]args){new A().solve();}
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 *
 *
 * 3 2 3 5
 * -2 -1 4 -1 2 7 3
 *
 * 10 1 -10617 30886 -7223 -63085 47793 -61665 -14614 60492 16649 -58579 3 8 1
 * 10 4 7 1 7 3 7
 *
 * 22862 -34877
 *
 * @author pttrung
 */
public class D {

    public static long MOD = 1000000007;
    static int x = 0, y = 0;
    static boolean start;
    public static long[][] dp, c;
    public static int[] X = {0, 1, 0, -1};
    public static int[] Y = {1, 0, -1, 0};

    public static void main(String[] args) throws FileNotFoundException {
        PrintWriter out;
        Scanner in = new Scanner();
        // out = new PrintWriter(new FileOutputStream(new File("output.txt")));
        out = new PrintWriter(System.out);
        int result = 0;
        String line = in.next();
        int last = 1;
        for (int i = 1; i < line.length(); i++) {
            if (line.charAt(i) == line.charAt(i - 1)) {
                last++;
            } else {
                if (last % 2 == 0) {
                    result++;
                }
                last = 1;
            }
        }
        if (last % 2 == 0) {
            result++;
        }
        out.println(result);
        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return x - o.x;
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

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

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

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

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

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

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

    static class TaskB {
        ArrayList<Integer> primes;
        ArrayList<Integer> facors;
        int[] pf;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            init();
            int X2 = in.nextInt();

            facors(X2);

            int low = 3;
            int hi = X2 - 1;
            int mid = 0;
            int ans = -1;
            while (low <= hi) {
                mid = (low + hi) / 2;
                if (check(mid, X2)) {
                    ans = mid;
                    hi = mid - 1;
                } else {
                    low = mid + 1;
                }
            }

            out.println(ans);
        }

        private void facors(int x2) {
            facors = new ArrayList<>();
            int cur = pf[x2];
            while (cur > 1) {
                facors.add(pf[cur]);
                int ppf = pf[cur];
                while (cur % ppf == 0)
                    cur /= ppf;
            }

            if (cur > 1)
                facors.add(cur);

            Collections.sort(facors);
        }

        private boolean check(int x0, int x2) {
            for (Integer p : primes) {
                if (p >= x0) break;

                int x1 = (x0 / p) * p;
                x1 += x1 < x0 ? p : 0;

                for (int p1 : facors) {
                    if (p1 >= x1) break;
                    if (x2 % p1 != 0) continue;
                    int xx2 = (x1 / p1) * p1;
                    xx2 += xx2 < x1 ? p1 : 0;

                    if (xx2 == x2)
                        return true;
                }
            }

            return false;
        }

        private void init() {
            pf = new int[(int) 1e6 + 1];
            primes = new ArrayList<>();

            for (int i = 2; i < pf.length; ++i) {
                if (pf[i] != 0) continue;
                primes.add(i);
                pf[i] = i;
                for (int j = i + i; j < pf.length; j += i) {
                    pf[j] = i;
                }
            }
        }

    }
}


import java.io.*;

public class Digits_Sequence_Easy_Edition_117A {

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int x = Integer.parseInt(br.readLine());
		System.out.println(calculate(x));

	}

	public static int calculate(int x) {
		if ((0 <= x) && (x <= 9)) {
			return x;
		}

		x--;
		int n = 1;
		while ((x - (9*n*(int)Math.pow(10, n-1))) >= 0) {
			x = x - (9*n*(int)Math.pow(10, n-1));
			n++;
		}

		int mod = x % n;

		if (mod == 0 % n) {
			return (x/(n*(int)Math.pow(10, n-1)))+1;
		}

		return (x%(n*(int)Math.pow(10, n-mod)))/(n*(int)Math.pow(10, n-mod-1));
	}

}


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

public class ZonesNew {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();
		int r[][]= new int[m][3];
		int a[] = new int[n];
		Arrays.fill(a,h);
		for(int i=0;i<m;i++) {
			r[i][0] = sc.nextInt();
			r[i][1] = sc.nextInt();
			r[i][2] = sc.nextInt();
			for(int j=r[i][0];j<=r[i][1];j++){
				if(a[j-1]>r[i][2])
				a[j-1]=r[i][2];
			}
		}
		int sum = 0;
		for(int i=0;i<n;i++) {
			sum += a[i]*a[i];
		}
		System.out.println(sum);
	}
}


// http://codeforces.com/contest/959/problem/E

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

public class CF959E {

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        final long N = in.readLong() - 1;
        long res = 0;
        long i = 1;
        for (i = 1; i <= N; i = i << 1) {
            res = res + ((N - i) / (i << 1) + 1) * i;
        }
        out.print(res);
        closeStreams(out, in);
    }

    private static void closeStreams(OutputWriter out, InputReader in) throws IOException {
        out.flush();
        out.close();
        in.close();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

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

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isEndOfLine(int c) {
            if (filter != null) {
                return filter.isEndOfLine(c);
            }
            return c == '\n' || c == '\r' || c == -1;
        }

        public String next() {
            return readString();
        }

        public void close() throws IOException {
            this.stream.close();
        }

        public interface SpaceCharFilter {
            boolean isSpaceChar(int ch);

            boolean isEndOfLine(int ch);
        }

    }

    static class IOUtils {

        public static int[] readIntArray(InputReader in, int elementCount) {
            return readIntArray(in, elementCount, 0);
        }

        public static int[] readIntArray(InputReader in, int elementCount, int startOffset) {
            int[] array = new int[elementCount + startOffset];
            for (int i = 0; i < elementCount; i++)
                array[i + startOffset] = in.readInt();
            return array;
        }

        public static long[] readLongArray(InputReader in, int elementCount) {
            return readLongArray(in, elementCount, 0);
        }

        public static long[] readLongArray(InputReader in, int elementCount, int startOffset) {
            long[] array = new long[elementCount + startOffset];
            for (int i = 0; i < elementCount; i++)
                array[i + startOffset] = in.readLong();
            return array;
        }

    }

    static class OutputWriter {

        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }
}


import java.util.*;

public class a {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
in.next();
String str = in.next();
if(str.contains("CC")||str.contains("YY")||str.contains("MM")){
System.out.println("No");
return;
}

if(str.startsWith("?")||str.endsWith("?")||str.contains("??")||str.contains("C?C")||str.contains("Y?Y")||str.contains("M?M"))
System.out.println("Yes");
else
System.out.println("No");

}
}