import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class GreatestBeautifulInteger {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner in= new Scanner(System.in);

		int n=in.nextInt();

		if(n<=3) {
			System.out.println(1);
		}

		else {

		Set<Integer> set= new HashSet<Integer>();

		for(int i=1;i<=n/i;i++) {
			if(n%i==0) {
				set.add(i);
				set.add(n/i);
			}

		}

		int max=Integer.MIN_VALUE;

		for(Integer i : set) {
			String s=i.toBinaryString(i);
			//System.out.println(s);
			boolean flag=true;

			for(int j=0;j<(s.length()/2)+1;j++) {
				//System.out.println(j+" "+s.charAt(j));
				if(s.charAt(j)!='1') {
					flag=false;
					break;
				}
			}

			for(int j= (s.length()/2)+1; j<s.length();j++) {

				//System.out.println(j+" "+s.charAt(j));
				if(s.charAt(j)!='0') {
					flag=false;
					break;
				}
			}

			if(flag==true) {
				if(i>max) {
					max=i;
				}
			}
		}

		System.out.println(max);
		}

	}

}


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

    public  class Sample implements Runnable
    {
          static int max=1000005;
          static int[] a=new int[max];
          public static void solve()
          {
            int number =0;
            int k=0;
            while(number<max)
            {
              a[number]=1;
              number=(int)(Math.pow(2,k)-1)*(int)(Math.pow(2,k-1));

              k++;
            }
            int input=i();
            int ans=1;
            for(int i=1;i<Math.sqrt(input);i++)
            {
              if(input%i==0)
              {
                if(i==(input/i))
                {
                  if(a[i]==1)ans=Math.max(ans,i);

                }
                else
                {
                  if(a[i]==1)ans=Math.max(ans,i);
                  if(a[input/i]==1)ans=Math.max(ans,input/i);
                }
              }
            }
            out.println(ans);
          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;
            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

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

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    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 long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          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 int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }


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

public class Solution {
    static boolean test =false;

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() throws FileNotFoundException {

            InputStream inputStream = test ? new FileInputStream("/Users/aj/code/HackerRank/input.txt") : System.in;
            br = new BufferedReader(new
                    InputStreamReader(inputStream));//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;
        }
    }

    public static int gcd(int a,int b){
        if(a==0 || b==0) return a+b;
        else return gcd(b,a%b);
    }
    static long mod=1000000000+7;
    public static long compute(long base, long exp){
        long res=0;
        if(exp>1){
            long res1=compute(base,exp/2);
            res=res1*res1;
            res%=mod;
            if(exp%2==1) {
                res *= base;
                res %= mod;
            }
        }
        else{
            res=base;
        }
        return res;
    }
    public static void main(String[] args) throws FileNotFoundException {
        FastReader in = new FastReader();
        int n;
        n=in.nextInt();
        int r=0;
        for(int k=1;k<20;k++) {
           int nm=((1<<k)-1);
           nm*=1<<(k-1);
           if(n%nm==0)
               r=nm;
        }
        System.out.println(r);

    }
}


import java.util.Scanner;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int index = (int)Math.sqrt(n) + 1;
        for(int i = 2; i <= index; i++){
            if(n%i == 0 && beautiful(n/i)){
                System.out.println(n/i);
                System.exit(0);
            }
        }

        for(int i = index; i >= 1; i++){
            if(n%i == 0 && beautiful(i)){
                System.out.println(i);
                System.exit(0);
            }
        }
    }

    static boolean beautiful(int n){
        StringBuilder s = new StringBuilder();
        while (n > 0){
            int rem = n%2;
            n = n / 2;
            s.append(String.valueOf(rem));
        }
        String str = s.toString();
        int len = str.length();
        int count = 0;
        for(int i = 0; i < len; i++){
            if(str.charAt(i) == '1'){
                count++;
            }
        }
        return (count*2-1 == len);
    }
}


import java.util.Scanner;
public class A_577 {

	public static void main(String [] args) {
		Scanner user = new Scanner(System.in);
		int n = user.nextInt();
		int x = user.nextInt();
		int con = 0;

		if (n == 1 && x !=1){
			con = 0;
		}else if (x == 1){
			con = 1;
		}else{
			int [][] t = new int [n][n];
			for (int i = 0; i < t.length; i++) {
				for (int j = 0; j < t[0].length; j++) {
					t [i][j] = (1 + i) * (1 + j) ;

					if(x == t[i][j]){
						con++;
					}
				}

			}
		}

		System.out.println(con);
	}

}


import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long x=sc.nextLong();
		int [][]cell=new int [(int) n][(int) n];
		int c=0;
		for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) {
				cell[i][j]=(i+1)*(j+1);
				if (cell[i][j]==x) {
					c++;
				}
			}
		}

		System.out.println(c);
	}

}


import java.util.Scanner;
public class A_577 {

	public static void main(String[] args) {
		Scanner user = new Scanner(System.in);
		int n = user.nextInt();
		int x = user.nextInt();
		int [][] t = new int [n + 1][n + 1];
		int con = 0;

		for (int i = 1; i < t.length; i++) {
			for (int j = 1; j < t[0].length; j++) {
				t [i][j] = i * j ;

				if (x == t[i][j]){
					con++;
				}
			}

		}
		System.out.println(con);
	}

}


import java.util.*;

import org.omg.Messaging.SyncScopeHelper;
public class MultiplicationTable {

	public static void main(String[] args) {
		Scanner t= new Scanner(System.in);
		int n=t.nextInt();
		int x=t.nextInt();
		int cont=0;
		t.close();
		System.runFinalization();
		System.gc();
		int m[][]= new int[n][n];

		System.runFinalization();
		System.gc();
		for (int i = 1; i <= m.length; i++) {
			for (int j = 1; j <= m.length; j++) {
				m[i-1][j-1]=i*j;
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if(m[i][j]==x)cont++;
			}
		}
		System.runFinalization();
		System.gc();
		System.out.println(cont);

		/*for (int i = 0; i < m.length; i++) {
			for (int j = 0; j < m.length; j++) {
				System.out.print(m[i][j]+" ");
			}
		System.out.println();
		}*/

	}
}


import java.util.*;
public class B148 {
	public static double EPS = 1e-9;
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		double vp = s.nextInt(), vd = s.nextInt(),t = s.nextInt(), f  = s.nextInt(), c = s.nextInt();
		double T1 = t;
		double arrivalTime = c / vp;
		int coin = 0;
		while (true) {
			double nextMeet = vd * T1 / (vd - vp);
			if (nextMeet >= arrivalTime - EPS) break;
			coin++;
			T1 = T1 + f + 2*(nextMeet - T1);
		}
		System.out.println(coin);
	}
}


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

public class C105P2 {

    private static BufferedReader in;
    private static PrintWriter out;
    private static StringTokenizer input;

    public static void main(String[] args) throws IOException {
        //-------------------------------------------------------------------------
        //Initializing...
        new C105P2();
        //-------------------------------------------------------------------------
        //put your code here... :)
        int vp = nextInt();
        int vd = nextInt();
        int t = nextInt();
        int f = nextInt();
        int c = nextInt();
        double x = newplace(t, vp);
        int count =0;
        while(c-x>0.000001){
            double d=meetingpoint(x, vd, vp);
            x+=d;
            if(c-x>0.000001)count++;
            else break;
            double tt = toyalTimeTillChase(x, vd, f);
            x+=newplace(tt, vp);
        }

        writeln(""+count);
        //-------------------------------------------------------------------------
        //closing up
        end();
        //--------------------------------------------------------------------------

    }

    public static double toyalTimeTillChase(double x,int vd,int f){
        return x/vd +f;
    }
    public static double newplace(double t , double vp){
        return t*vp;
    }
    public static double meetingpoint(double x,int vd,int vp){
        return x*vp/(vd-vp);
    }
    public C105P2() throws IOException {
        //Input Output for Console to be used for trying the test samples of the problem
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //-------------------------------------------------------------------------
        //Initalize Stringtokenizer input
        input = new StringTokenizer(in.readLine());
    }

    private static int nextInt() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Integer.parseInt(input.nextToken());
    }
    private static long nextLong() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Long.parseLong(input.nextToken());
    }
    private static double nextDouble() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return Double.parseDouble(input.nextToken());
    }
    private static String nextString() throws IOException {
        if (!input.hasMoreTokens())input=new StringTokenizer(in.readLine());
        return input.nextToken();
    }
    private static void write(String output){
        out.write(output);
        out.flush();
    }
    private static void writeln(String output){
        out.write(output+"\n");
        out.flush();
    }
    private static void end() throws IOException{
        in.close();
        out.close();
        System.exit(0);
    }

}


import java.util.Scanner;

public class two {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int vp = sc.nextInt();
        int vd = sc.nextInt();
        int t = sc.nextInt();
        int f = sc.nextInt();
        int c = sc.nextInt();
        double time = c * 1.0 / vp - t;
        int t1 = 0;
        int count = 0;
        double dist = vp * t;
        time = (c - dist) / vp;
        double remDist = c - dist;
        while (time > 0) {
            double tdash = dist * 1.0 / (vd - vp);
            time -= tdash;
            if (time > 0)
                count++;
            dist += vp * tdash;
            time -= dist / vd + f;

            dist += vp * (dist / vd + f);

        }
        /*
         * while (true) { double t2 = (vp * (t + t1) * 1.0) / (vd - vp); t1 +=
         * t2; if (t1 <= time) count++; else break; t1 += (vd * t2) + f; }
         */
        System.out.println(count);
    }
}


import java.util.Scanner;

public class Solution {

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

        int vPrinc = reader.nextInt();
        int vDrag = reader.nextInt();
        int dt = reader.nextInt();
        int waste = reader.nextInt();
        int dist = reader.nextInt();

        if (vPrinc >= vDrag) {
            System.out.print(0);
            return;
        }

        double s = vPrinc * dt;
        double dv = vDrag - vPrinc;

        int taken = 0;

        while (s < dist) {
            double t = s / dv;
            s += vPrinc * t;

            if (s == dist) break;

            t = s / vDrag + waste;
            s += vPrinc * t;

            taken++;
        }

        System.out.println(taken);
    }
}


package Raound70;

import java.util.Scanner;

public class C {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();
        if (n % 2==1) {
            for (int i = 2; i*i <= m; i++) {
                if (m % i==0) {
                    if (m / i >= k) {
                        System.out.println("Timur");
                    }
                    else {
                        System.out.println("Marsel");
                    }
                    return;
                }
            }
            if (n != 1 && k==1) {
                System.out.println("Timur");
            }
            else {
                System.out.println("Marsel");
            }
        }
        else {
            System.out.println("Marsel");
        }
    }
}


import java.util.*;

public class beaver {
	static ArrayList<Integer>[] adj;
	static int n, m, k;
	static int[] nim;

	public static int dfs(int idx) {
		if (nim[idx] != -1) return nim[idx];
		else if (adj[idx].size() == 0) return nim[idx] = 0;

		HashSet<Integer> children = new HashSet<>();
		for (int child : adj[idx])
			children.add(dfs(child));

		nim[idx] = 0;
		while (children.contains(nim[idx])) nim[idx]++;

		return nim[idx];
	}

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

		n = sc.nextInt(); m = sc.nextInt(); k = sc.nextInt();

		if ((n&1) == 0) {
			System.out.println("Marsel");
			System.exit(0);
		}

		ArrayList<Integer> factors = new ArrayList<>();

		for (int i=1; i*i<=m; i++) {
			if (m%i != 0) continue;

			if (i >= k) factors.add(i);
			if (i*i < m && m >= k*i) factors.add(m/i);
		}

		int n = factors.size();
		Collections.sort(factors);
		adj = new ArrayList[n];

		for (int i=0; i<n; i++) adj[i] = new ArrayList<>();

		for (int i=0; i<n; i++)
			for (int j=i+1; j<n; j++)
				if (factors.get(j) % factors.get(i) == 0)
					adj[j].add(i);

		nim = new int[n];
		Arrays.fill(nim, -1);

		System.out.println(dfs(n-1) == 0 ? "Marsel" : "Timur");
	}
}


import java.util.InputMismatchException;
import java.math.BigInteger;
import java.util.*;
import java.util.List;
import java.util.Iterator;
import java.util.Comparator;
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.NavigableSet;
import java.util.Map;
import java.util.Collections;
import java.util.HashMap;
import java.util.Set;
import java.util.Collection;
import java.util.ArrayList;
import java.io.*;
import java.util.HashSet;

/**
 * Generated by Contest helper plug-in
 * Actual solution is at the bottom
 */
public class Main {
	public static void main(String[] args) {
		InputReader in = new StreamInputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		run(in, out);
	}

	public static void run(InputReader in, PrintWriter out) {
		Solver solver = new TaskC();
		solver.solve(1, in, out);
		Exit.exit(in, out);
	}
}

abstract class InputReader {
	private boolean finished = false;

	public abstract int read();

	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 String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuffer res = new StringBuffer();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

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

	public void setFinished(boolean finished) {
		this.finished = finished;
	}

	public abstract void close();
}

class StreamInputReader extends InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar, numChars;

	public StreamInputReader(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++];
	}

	@Override
	public void close() {
		try {
			stream.close();
		} catch (IOException ignored) {
		}
	}
}

class Exit {
	private Exit() {
	}

	public static void exit(InputReader in, PrintWriter out) {
		in.setFinished(true);
		in.close();
		out.close();
	}
}

interface Solver {
	public void solve(int testNumber, InputReader in, PrintWriter out);
}

interface Filter<T> {
	public boolean accept(T value);
}

class CollectionUtils {

	public static<T> List<T> filter(Iterable<T> sequence, Filter<T> filter) {
		List<T> result = new ArrayList<T>();
		for (T element : sequence) {
			if (filter.accept(element))
				result.add(element);
		}
		return result;
	}

	}

class Pair<U, V> {

	public final U first;
	public final V second;

	public static<U, V> Pair<U, V> makePair(U first, V second) {
		return new Pair<U, V>(first, second);
	}

	private Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		Pair pair = (Pair) o;

		return !(first != null ? !first.equals(pair.first) : pair.first != null) && !(second != null ? !second.equals(pair.second) : pair.second != null);

	}

	@Override
	public int hashCode() {
		int result = first != null ? first.hashCode() : 0;
		result = 31 * result + (second != null ? second.hashCode() : 0);
		return result;
	}

	@Override
	public String toString() {
		return "(" + first + "," + second + ")";
	}
}

abstract class ReadOnlyIterator<T> implements Iterator<T>  {
	public final void remove() {
		throw new UnsupportedOperationException();
	}
}

class IOUtils {

	public static<T> void printCollection(Iterable<T> collection, PrintWriter out, String delimiter) {
		boolean isFirst = true;
		for (T element : collection) {
			if (isFirst)
				isFirst = false;
			else
				out.print(delimiter);
			out.print(element);
		}
		out.println();
	}

	}

abstract class AbstractSequence<T> implements Sequence<T> {

	public Iterator<T> iterator() {
		return new ReadOnlyIterator<T>() {
			private int index = 0;

			public boolean hasNext() {
				return index != size();
			}

			public T next() {
				if (!hasNext())
					throw new NoSuchElementException();
				return get(index++);
			}
		};
	}

	@Override
	public String toString() {
		StringWriter writer = new StringWriter();
		IOUtils.printCollection(this, new PrintWriter(writer), ",");
		return "[" + writer.toString().substring(0, writer.toString().length() - 1) + "]";
	}

	}

abstract class AbstractWritableSequence<T> extends AbstractSequence<T> implements WritableSequence<T> {

	}

interface Sequence<T> extends Iterable<T> {
	public int size();
	public T get(int index);
}

interface WritableSequence<T> extends Sequence<T> {
	public void set(int index, T value);
	}

class SequenceUtils {

	@SuppressWarnings({"unchecked"})
	public static<T extends Comparable<T>> WritableSequence<T> sort(WritableSequence<T> sequence) {
		return sort(sequence, null);
	}

	@SuppressWarnings({"unchecked", "RedundantCast"})
	public static<T> WritableSequence<T> sort(WritableSequence<T> sequence, Comparator<? super T> comparator) {
		makeHeap(sequence, comparator);
		for (int i = sequence.size() - 1; i > 0; i--) {
			T temp = sequence.get(0);
			sequence.set(0, sequence.get(i));
			sequence.set(i, temp);
			siftDown(sequence, 0, i, comparator);
		}
		return sequence;
	}

	private static<T> WritableSequence<T> makeHeap(WritableSequence<T> sequence, Comparator<? super T> comparator) {
		int length = sequence.size();
		for (int i = length / 2 - 1; i >= 0; i--)
			siftDown(sequence, i, length, comparator);
		return sequence;
	}

	private static<T> void siftDown(WritableSequence<T> sequence, int start, int end, Comparator<? super T> comparator) {
		int root = start;
		while (2 * root + 1 < end) {
			int childIndex = 2 * root + 1;
			if (childIndex + 1 < end && compare(sequence.get(childIndex), sequence.get(childIndex + 1), comparator) < 0)
				childIndex++;
			if (compare(sequence.get(childIndex), sequence.get(root), comparator) <= 0)
				return;
			T temp = sequence.get(root);
			sequence.set(root, sequence.get(childIndex));
			sequence.set(childIndex, temp);
			root = childIndex;
		}
	}

	private static<T> int compare(T first, T second, Comparator<? super T> comparator) {
		if (comparator != null)
			return comparator.compare(first, second);
		//noinspection unchecked
		return ((Comparable<? super T>)first).compareTo(second);
	}

	}

class ListWrapper<T> extends AbstractWritableSequence<T> {
	private final List<T> list;

	public static<T> WritableSequence<T> wrap(List<T> list) {
		return new ListWrapper<T>(list);
	}

	private ListWrapper(List<T> list) {
		this.list = list;
	}

	public void set(int index, T value) {
		list.set(index, value);
	}

	public int size() {
		return list.size();
	}

	public T get(int index) {
		return list.get(index);
	}
}

class IntegerUtils {

	public static List<Pair<Long, Integer>> factorize(long number) {
		List<Pair<Long, Integer>> result = new ArrayList<Pair<Long, Integer>>();
		for (long i = 2; i * i <= number; i++) {
			if (number % i == 0) {
				int power = 0;
				do {
					power++;
					number /= i;
				} while (number % i == 0);
				result.add(Pair.makePair(i, power));
			}
		}
		if (number != 1)
			result.add(Pair.makePair(number, 1));
		return result;
	}

	public static List<Long> getDivisors(long number) {
		List<Pair<Long, Integer>> primeDivisors = factorize(number);
		return getDivisorsImpl(primeDivisors, 0, 1, new ArrayList<Long>());
	}

	private static List<Long> getDivisorsImpl(List<Pair<Long, Integer>> primeDivisors, int index, long current,
		List<Long> result)
	{
		if (index == primeDivisors.size()) {
			result.add(current);
			return result;
		}
		long p = primeDivisors.get(index).first;
		int power = primeDivisors.get(index).second;
		for (int i = 0; i <= power; i++) {
			getDivisorsImpl(primeDivisors, index + 1, current, result);
			current *= p;
		}
		return result;
	}

	}

class TaskC implements Solver {
	public void solve(int testNumber, InputReader in, PrintWriter out) {
		int count = in.readInt();
		int length = in.readInt();
		final int minLength = in.readInt();
		if (count % 2 == 0) {
			out.println("Marsel");
			return;
		}
		WritableSequence<Long> divisors = ListWrapper.wrap(CollectionUtils.filter(IntegerUtils.getDivisors(length), new Filter<Long>() {
			public boolean accept(Long value) {
				return value >= minLength;
			}
		}));
		SequenceUtils.sort(divisors);
		Map<Long, Integer> nimber = new HashMap<Long, Integer>();
		for (long divisor : divisors) {
			Set<Integer> nimbers = new HashSet<Integer>();
			for (long otherDivisor : divisors) {
				if (divisor == otherDivisor)
					break;
				if (divisor % otherDivisor == 0)
					nimbers.add(divisor / otherDivisor % 2 == 0 ? 0 : nimber.get(otherDivisor));
			}
			for (int i = 0; ; i++) {
				if (!nimbers.contains(i)) {
					nimber.put(divisor, i);
					break;
				}
			}
		}
		if (nimber.get((long)length) == 0)
			out.println("Marsel");
		else
			out.println("Timur");
	}
}


import java.util.*;

/**
 * Created by IntelliJ IDEA.
 * User: piyushd
 * Date: 3/18/11
 * Time: 9:28 PM
 * To change this template use File | Settings | File Templates.
 */
public class TaskC {

    void run(){
        int n = nextInt(), m = nextInt(), k = nextInt();

        if(canWin(n, m, k)){
            System.out.println("Timur");
        }else{
            System.out.println("Marsel");
        }
    }

    boolean canWin(long n, int m, int k){
        if(m < 2 * k) return false;

        //HashSet<Integer> factors = new HashSet<Integer>();
        int finalLength = Integer.MAX_VALUE;
        for(int i = 1; i * i <= m; i++){
            if(m % i == 0){
                if(m / i >= k){
                    finalLength = Math.min(finalLength, m / i);
                }
                if(i >= k){
                    finalLength = Math.min(finalLength, i);
                }
            }
        }
        if(finalLength == Integer.MAX_VALUE) return false;

        if(finalLength < 2 * k){
            if(n % 2 == 0) return false;
            else return true;
        }else{
            if(n % 2 == 0) return canWin(n * (m / finalLength), finalLength, k);
            else return !canWin(n * (m / finalLength), finalLength, k);
        }
    }

    int nextInt(){
        try{
            int c = System.in.read();
            if(c == -1) return c;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return c;
            }
            if(c == '-') return -nextInt();
            int res = 0;
            do{
                res *= 10;
                res += c - '0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

    long nextLong(){
        try{
            int c = System.in.read();
            if(c == -1) return -1;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return -1;
            }
            if(c == '-') return -nextLong();
            long res = 0;
            do{
                res *= 10;
                res += c-'0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

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

    String next(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(Character.isWhitespace(c))
                c = System.in.read();
            do{
                res.append((char)c);
            }while(!Character.isWhitespace(c=System.in.read()));
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

    String nextLine(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(c == '\r' || c == '\n')
                c = System.in.read();
            do{
                res.append((char)c);
                c = System.in.read();
            }while(c != '\r' && c != '\n');
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

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


import java.io.*;
import java.util.*;
public class hi
{
public static void main(String ars[])throws IOException
{
Scanner s=new Scanner(System.in);
//BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
long a=s.nextLong();
int count=0;
while(a>0)
{
if(a%10==4||a%10==7)
count++;
}
if(count==4||count==7)
System.out.print("YES");
else
System.out.print("NO");
}
}


import java.util.Scanner;

public class TryJava {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long n;
		Scanner in= new Scanner (System.in);
		n=in.nextLong();
		int f=0;
		if(n==0)
			System.out.print("NO");
		else
		{
		while(n>0)
		{
			if(n%10==4||n%10==7)
			{
				f++;
				n/=10;
			}
		}
		if(f%4==0||f%7==0)
			System.out.print("YES");
		else
			System.out.print("NO");
		}
	}
}


import java.util.*;

public class LuckyNumber {

	public static void main(String args[]) {

		Scanner in = new Scanner(System.in);
		long n;
        int e, a = 0, b = 0;
		n = in.nextLong();
		while(n>0)
		{
			e = (int)(n % 10);
			if((e == 4)||(e == 7))
				a++;
			else
				b++;
				}
		if (b == 0)
			System.out.println("NO");
		else
			System.out.println("YES");

	}

}


import java.io.*;
import java.util.*;
public class hi
{
public static void main(String ars[])throws IOException
{

BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
long a=Integer.parseInt(in.readLine());
int count=0;
while(a>0)
{
if(a%10==4||a%10==7)
a/=10;
count++;
}
if(count==4||count==7)
System.out.print("YES");
else
System.out.print("NO");
}
}


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

public class Coding {

    public static int find(int[]x){
        for (int i = 0; i < x.length-2; i++) {
            if(x[i]==x[i+1]&&x[i]==x[i+2]){
                return x[i];
            }
        }
        return -1 ;
    }
    public static void main(String[] args) {

        Scanner in = new Scanner (System.in);
        int sp=0 ;
        int S ;
        int sp2= 0 ;
        int ac =0;
        int count = 0 ;
        int []x = new int[5];
        for (int i = 0; i < 5; i++) {

          x[i]=in.nextInt() ;
        }
        Arrays.sort(x);
        if(find(x)!=-1){
               sp2 = find(x) ;
           }
        for (int i = 0; i < 5; i++) {

            if(i!=4){
           if(x[i]==x[i+1]&&x[i]>=sp){
              sp=x[i];
           }
        }
        }

        if(find(x)!=-1&&sp>sp2){
          S= sp ;
        }else S = sp2 ;

        for (int i = 0; i < 5; i++) {
            if(x[i]!=S){
                count+=x[i];
            }else{

                if(ac>=3){
                   count+=x[i];
                }
                ac++ ;
            }
        }
        System.out.println(count);
    }
}


import java.util.Scanner;

public class Solution
{
    public static void main(String[] args) throws Exception
    {
        Scanner scanner = new Scanner(System.in);
        int a[] = new int[5];
        int k = 0;
        int c = 0;
        a [0] = scanner.nextInt();
        int max = a[0];
        int sum = a[0];
        int min = a[0];
        for (int i = 1; i < 5; i++)
        {
            a[i] = scanner.nextInt();
            sum = a[i] + sum;
            if (max > a[i])
            {
                max = a[i];
            }
        }
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j < 5; j++)
            {
                if (a[i] == a[j])
                {
                    if (max < a[i] && i != j)
                    {
                        max = a[i];
                    }
                    else min = a[i];
                }
            }
        }
        for (int i = 0; i < 5; i++)
        {
            if (max == a[i])
            {
                k++;
            }
            if (min == a[i])
            {
                c++;
            }
        }

        if (k >= 3)
            k = 3;
        if (k == 1)
            k = 0;
        if (c == 1)
            c = 0;
        if (k*max > c*min)
        System.out.print(sum - (max * k));
        else if (k*max < c*min)
            System.out.print(sum - (min * c));
        else System.out.println(sum);
    }
}


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

public class Main
{
	public static void main(String[] args)
	throws IOException
	{
		Reader r = new Reader();
		PrintWriter writer = new PrintWriter(System.out);

		r.readLine();
		ArrayList<Integer> arr = new ArrayList<Integer>();

		int co;
		int sum = 0;
		for (int i=0;i < 5;++i)
		{
			arr.add(r.readInt(0));
			sum += arr.get(i);
		}

		int min = sum;
		for(int i=0;i<5;++i)
		{
			co = 1;
			for(int j=0;j<5;++j)
			{
				if(i==j)
					continue;
				if(arr.get(i).equals(arr.get(j)))
					++co;

			}

			if(co==1)
			{
				if(sum-arr.get(i)<min)
					min = sum-arr.get(i);
			}
			else
			if(co==2)
			{
				if(sum-arr.get(i)*3<min)
					min = sum-arr.get(i)*2;
			}
			else
			{
				if(sum-arr.get(i)*3<min)
					min = sum-arr.get(i)*3;
			}

		}

		System.out.println(min);
		writer.close();
		r.close();
	}
}

class Pair implements Comparable<Pair>
{
	int f,s;

	public Pair(int f, int s)
	{
		this.f = f;
		this.s = s;
	}

	@Override
	public String toString()
	{
		// TODO: Implement this method
		return f + " " + s;
	}

	@Override
	public int compareTo(Pair o)
	{
		// TODO: Implement this method
		if (f == o.f)
			return s - o.s;
		return f - o.f;
	}
}

class Reader
{
    private BufferedReader reader;
    private String line[];

    public Reader()
    {
        reader = new BufferedReader(
            new InputStreamReader(System.in));
    }

    public void readLine()
    throws IOException
    {
        line = reader.readLine().split(" ");
    }

    public int readInt(int pos)
    throws IOException
    {
        return Integer.parseInt(line[pos]);
    }

    public double readDouble(int pos)
    throws IOException
    {
        return Double.parseDouble(line[pos]);
    }

    public long readLong(int pos)
    throws IOException
    {
        return Long.parseLong(line[pos]);
    }

    public String readString(int pos)
    throws IOException
    {
        return line[pos];
    }

    public void close()
    throws IOException
    {
        reader.close();
    }
}


import java.util.*;
public class BearAndFivecarda
{
public static void main(String[] args)
{
 Scanner sc = new Scanner(System.in);
 int[] a = new int[5];
 for(int i = 0;i < 5;i++)
 {
       a[i] = sc.nextInt();
 }
 int c = 0;
 int[] sum = new int[5];
 for(int i = 0;i < 5;i++)
 {
       for(int j = 0;j < 5;j++)
       {
             if(a[i]==a[j])
             {
                   c++;
             }
       }
       if(c <= 3 && c >= 2)
       {
             int p = i;
             for(int l = 0;l < 5;i++)
             {
                   if(a[p]==a[l])
                   {
                         a[l] = 0;
                   }
             }
             int sol = 0;
             for(int l = 0;l < 5;l++)
             {
                   sol += a[l];
             }
             sum[i] = sol;
             c = 0;
       }
       else
       {
             sum[i] = a[0]+a[1]+a[2]+a[3]+a[4];
             c = 0;
       }
 }
 int min=0;
 for(int i = 0;i < 4;i++)
 {
       min = Math.min(a[i],a[i+1]);
 }
 System.out.println(min);
}
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int[] n = new int[4];
		n[0] = Integer.parseInt(in.readLine());
		n[1] = Integer.parseInt(in.readLine());
		n[2] = Integer.parseInt(in.readLine());
		n[3] = Integer.parseInt(in.readLine());
		int d = Integer.parseInt(in.readLine());
		Arrays.sort(n);
		for(int i=3; i>=1; --i){
			for(int j=0; j<i; ++j){
				if(n[i]%n[j]==0){
					n[i] = 11; // out of range
					break;
				}
			}
		}
		Arrays.sort(n);
		// find max<11
		int max_len = 5;
		for(int i=1; i<4; ++i){
			if(n[i]>10){
				max_len = i-1;
				break;
			}
		}

		int count = 0;
		for(int i=1; i<=d; ++i){
			for(int j=0; j<=max_len; ++j){
				if(i%n[j]==0){
					++count;
					break;
				}
			}
		}
		System.out.println(count);
	}

}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int[] n = new int[4];
		n[0] = Integer.parseInt(in.readLine());
		n[1] = Integer.parseInt(in.readLine());
		n[2] = Integer.parseInt(in.readLine());
		n[3] = Integer.parseInt(in.readLine());
		int d = Integer.parseInt(in.readLine());
		for(int i=3; i>=1; --i){
			for(int j=0; j<i; ++j){
				if(n[i]%n[j]==0){
					n[i] = 11; // out of range
					break;
				}
			}
		}
		Arrays.sort(n);
		// find max<11
		int max_len = 5;
		for(int i=1; i<4; ++i){
			if(n[i]>10){
				max_len = i-1;
				break;
			}
		}

		int count = 0;
		for(int i=1; i<=d; ++i){
			for(int j=0; j<=max_len; ++j){
				if(i%n[j]==0){
					++count;
					break;
				}
			}
		}
		System.out.println(count);
	}

}


import java.util.Scanner;

public class InsomniaCure {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int k=in.nextInt();
        int l=in.nextInt();
        int m=in.nextInt();
        int n=in.nextInt();
        int d=in.nextInt();
        int sum=0;
        boolean a[] = new boolean[d+1];
        for(int i=k;i<=d;i+=k) {if(a[i]==false)sum++; a[i]=true;}
        for(int i=l;i<=d;i+=l) {if(a[i]==false)sum++; a[i]=true;}
        for(int i=m;i<=d;i+=m) {if(a[i]==false)sum++; a[i]=true;}
        for(int i=n;i<=n;i+=l) {if(a[i]==false)sum++; a[i]=true;}
        System.out.println(sum);
    }

}


import java.util.*;
public class insomnia_cure
{
    public static void main()
    {
        Scanner sc=new Scanner(System.in);
        int k=sc.nextInt();
        int l=sc.nextInt();
        int m=sc.nextInt();
        int n=sc.nextInt();
        int d=sc.nextInt();
        int c=0;
        if((k>0)&&(l>0)&&(m>0)&&(n>0))
        {
        for(int i=1;i<=d;i++)
        {
            if((i%k==0)||(i%l==0)||(i%m==0)||(i%n==0))
            c++;
        }

        System.out.println(c);
        System.exit(0);
    }
    }
}


/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
	    int v = sc.nextInt();
	    int temp = 1;
	    int sum = 0;
	    int lit = 0;
	    while(temp != n - v + 1){
	        if(temp == 1)sum = v;
	        else sum += temp;
	        temp++;
	    }
	    out.println(sum);
	    out.flush();
	}
}


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.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Gabriel Carrillo
 */
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);
        ASashaAndHisTrip solver = new ASashaAndHisTrip();
        solver.solve(1, in, out);
        out.close();
    }

    static class ASashaAndHisTrip {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), v = in.nextInt();
            if (v - 1 >= n) {
                out.println(n - 1);
            }
            long ans = v + sum(2, n - v);
            out.println(ans);
        }

        long sum(long k, long n) {
            long ans = 0;
            for (long i = k; k <= n; i++)
                ans += i;
            return ans;
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

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

        public InputReader(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
        }

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

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

    }

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

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

    }
}


import java.util.*;

public class HelloWorld {

     public static void main(String args[]){
        Scanner sc = new Scanner (System.in);
        int n = sc.nextInt();
        int v = sc.nextInt();
        int kms = n-1;
        int i = 1;
        int bought = 0;
        int cost = 0;
        while (kms != bought){
            if(i == 1){
                cost+=v;
                bought+=v;
            }else{
                cost =cost+ (1*i);
                bought++;
            }
            i++;
        }
        System.out.println(cost);

     }
}


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

import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Integer.getInteger;
import static java.lang.Integer.min;
import static java.lang.Integer.parseInt;

public class Main {
    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

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

    static BufferedReader in;
    static StringTokenizer tok;

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

        int n = scanInt();
        int v = scanInt();

        if(v == n - 1){
            System.out.println(v);
            return;
        }

        int i = 1;
        int sum = v;

        while (v != n - i){
            ++i;
            sum += i;
        }

        if (v == 1)
            System.out.println(n * (n - 1) / 2);
        else
            System.out.println(sum);

    }
}


import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;

public class sd {

	public static long max(long num, long num2)
	{
		return 1;
	}
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		Scanner s = new Scanner(System.in);
			//String s1 = br.readLine();
			int w = s.nextInt();
			int m = s.nextInt();
			boolean flag = true;
			int[] arr = new int[1000];
			int cntr = 0;
			while(m>0)
			{
				arr[cntr++] = m%w;
				m = m/w;
			}
			for(int i=0;i<arr.length;i++)
			{
				if(arr[i]!=0&&arr[i]!=1&&arr[i]!=w&&arr[i]!=w-1)
				{
					flag = false;
					break;
				}
				else
				{
					if(arr[i]==w||arr[i]==w-1)
					{
						arr[i+1]++;
					}
				}
			}

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


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

public class Abood2B {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		long w = sc.nextInt();
		long m = sc.nextLong();

		boolean[] u = new boolean[(int) Math.ceil(Math.log(m) / Math.log(w)) + 1];

		boolean can = true;

		while(can) {

			int l1 = (int) Math.ceil(Math.log(m) / Math.log(w));
			if(Math.pow(w, l1) == m && !u[l1])
				break;

			if((int) Math.pow(w, l1) - m > m || u[l1])
				if(u[l1 - 1])
					can = false;
				else {
					m -= (long) Math.pow(w, l1 - 1);
					u[l1 - 1] = true;
					if(m == 0)
						break;
				}
			else
				if(u[l1])
					can = false;
				else {
					m = (long) Math.pow(w, l1) - m;
					u[l1] = true;
					if(m == 0)
						break;
				}

		}

		System.out.println(can ? "YES": "NO");

		out.flush();

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

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

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

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

	}

}


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

/**
 * 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);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskC {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int w = in.nextInt();
        int m = in.nextInt();
        int[] d = new int[20];
        int i = 19;
        while (m > 0) {
            d[i] += m % w;
            if (d[i] > 1) {
                d[i] -= w;
                if (d[i] != 0 && d[i] != -1) {
                    out.println("NO");
                    return;
                }
                d[i - 1]++;
            }
            m /= w;
            i--;
        }
        out.println(d[i] == 0 || d[i] == 1 ? "YES" : "NO");
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

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

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

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

}


import java.io.*;

public class a{

	public static void main(String[] args) throws IOException{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		String[] ar=in.readLine().split(" ");
		int w=Integer.parseInt(ar[0]);
		int m=Integer.parseInt(ar[1]);
		int[] base=new int[40];
		for(int i=0;i<40 && m>0;++i){
			base[i]=m%w;
			m/=w;
		}
		boolean flag=true;
		for(int i=0;i<40;++i){
			if(base[i]!=0 && base[i]!=1 && base[i]!=w && base[i]!=w-1){
				flag=false;
				break;
			}
			if(base[i]==w-1 || base[i]==w)
				base[i+1]++;
		}
		if(flag)
			System.out.println("YES");
		else
			System.out.println("NO");
		in.close();
	}

}


import java.util.*;

public class football{
    public static void main (String []args){
        Scanner in=new Scanner (System.in);
        int number=in.nextInt();
        int array[]=new int[number];
        int count=0;

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

        if ((array[i]==1) && (array[i]==0)){
            count++;
        } }

        if (count>=7) {
            System.out.println("YES");
        }else{
            System.out.println ("NO");
        }

    }
}


import java.util.*;
public class Football{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int oc=0,zc=0;
        int  count=0,ocount=0;
        String s=sc.nextLine();
        /*for(int i=0;i<s.length();i++){
            if(s.charAt(i)==0){
                zc++;
            }
            else{
                oc++;
            }
        }*/
        int  i=0;
            while(true){
            while(s.charAt(i)==0&&i<s.length()){
                i++;
                count++;
            }
            if(count>=7){
                System.out.println("YES");
                break;
            }

            while(s.charAt(i)==1&&i<s.length()){
                i++;
                ocount++;
            }
            if(ocount>=7){
                System.out.println("YES");
            }

            if(count<7&&ocount<7&&i>=s.length()){
                System.out.println("NO");
            }

            }
        }
    }


import java.util.Scanner;

public class sasas {

    public static void main(String[]args) {
         Scanner sc = new Scanner(System.in);
         String s= sc.next();
         int a=0;
         int b=0;
         int i =0;
         while(i<s.length()){
         	if(s.charAt(i)=='1'&&a!=7){
         		a++;
         		i++;

         		}
         	else if (s.charAt(i)=='0'&&b!=7){
         		b++;
         		i++;

         	}
         }
         if(b>=7 || a>=7)
         	System.out.print("YES");
         else
         	System.out.print("NO");
    }}


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

public class A {
    private void solve() throws IOException {
        String s = nextToken();
        int count = 0;
        for (int i = 0;i < s.length(); i++) {
            if (count == 7) {
                System.out.println("YES");
                return;
            }
            if (s.charAt(i) == '0') {
                count++;
            } else {
                count = 0;
            }
        }
        for (int i = 0;i < s.length(); i++) {
            if (count == 7) {
                System.out.println("YES");
                return;
            }
            if (s.charAt(i) == '1') {
                count++;
            } else {
                count = 0;
            }
        }
        System.out.println("NO");
    }

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

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

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

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

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

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

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

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


import static java.lang.Math.min;
import java.util.*;
import java.io.*;
import java.math.*;

public class Solution implements Runnable
{
    /*static class Craft implements Comparable<Craft> {
        int size, cap, i;
        Craft(int a, int b, int c) {
                size = a;
                cap = b;
                i=c;
        }
        public int compareTo(Craft c) {
                int tmp =  (2*c.cap/c.size)-(2*cap/size);
                if(tmp == 0) return c.size-size;
                return tmp;
        }
    }*/
     static class Craft implements Comparable<Craft> {
        int size, cap, i;
        public Craft(int a, int b, int c){
        size = a;
         cap = b;
         i=c;}
         public int compareTo(Craft c) {
                int tmp =  (2*c.cap/c.size)-(2*cap/size);
                if(tmp == 0) return c.size-size;
                return tmp;
        }
     }

    void solve() throws IOException
    {
      int n=readInt();
      int a=n/36;
      //int b=(n-a*36)/3;
      int b=(n%36);

     if(b%3==1)
         b=b/3;
     else if(b%3==2)
         b=b/3+1;
     else b=b/3;
     out.println(a+" "+b);
     // out.println(b%3);
      // 3cm 1 dm
      // 1f  12 dm
      //42cm  / 36
      //42-36=   / 12
    }

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

        BufferedReader reader;
        PrintWriter out;
        StringTokenizer tokenizer;

        public void run()
        {
                try
                {
                        reader = new BufferedReader(new InputStreamReader(System.in));
                        tokenizer = null;
                        out = new PrintWriter(System.out);
                        solve();
                        reader.close();
                        out.close();
                }
                catch (Exception e)
                {
                        e.printStackTrace();
                        System.exit(1);
                }
        }

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

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

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

        BigInteger readBigInteger() throws IOException
        {
                return new BigInteger(readString());
        }

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


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

/**
 * Created by IntelliJ IDEA.
 * User: tiro
 * Date: 29/10/11
 * Time: 16:56
 * To change this template use File | Settings | File Templates.
 */

public class TaskA extends Thread {

    public void run() {
        try {
                 int n = nextInt();
            int foots = n/36;
            n %= 36;
            int inches = n/3;
            if ((n%=3)>1)
                inches++;
            out.print(foots+" "+ inches);
        } catch (Exception ex) {
            ex.printStackTrace();
            System.exit(999);
        } finally {
            out.flush();
            out.close();
        }
    }

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

    public TaskA() {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        setPriority(Thread.MAX_PRIORITY);
    }

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer stringTokenizer;

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

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

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

    private String nextToken() throws IOException {
        if (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
            stringTokenizer = new StringTokenizer(in.readLine(), "\t\n\r ");
        }
        return stringTokenizer.nextToken();
    }
}


import java.util.Scanner;

public class Balanda
{
    public static void main(String[] s)
    {
        Scanner in = new Scanner(System. in);
        int santimetr = in.nextInt();
        int duim = 0;
        int fut = 0;

        for (int i = 36; i < santimetr; )
        {
            santimetr = santimetr - i;
            fut++;
        }
        for (int i = 3; i <= santimetr; )
        {
            santimetr = santimetr - i;
            duim++;
        }
        if(santimetr == 2)
        {
            duim = duim+1;
        }
        System.out.print(fut+" ");
        System.out.println(duim);
    }
}


import java.util.*;
import java.io.*;
public class TestD{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        int f=n/36;
        int tt=(n-36*f);
        int d=tt/3;
        if(tt%3>=2)
            d++;
        prln(f+" "+d);

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    public static void pr(Object st){
	System.out.print(st);
    }
    public static void prln(Object st){
	System.out.println(st);
    }	 /****************************************************************/

}


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

public class A {

    private boolean doit() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> al = new ArrayList<Integer>();
        ArrayList<Integer> al2 = new ArrayList<Integer>();
        for(int i = 1; (i * (i + 1)) / 2 <= n ;i++){
            int temp = (i * (i + 1)) / 2;
            int temp2 = (n - temp) * 2;
            int temp3 = temp2 * 4 + 1;
            int t3 = (int) Math.round(Math.sqrt(temp3));
            if(t3 * t3 != temp2 * 4 + 1){
                continue;
            }
            int t4 = Math.max(t3 - 1, -1 * t3 - 1);
            int t5 = (t4) / 2;
            if(t5 * (t5 + 1) / 2 + temp == n){
                return true;
            }

        }

        return false;
    }
    public static void main(String[] args) {
        A obj = new A();
        boolean ans = obj.doit();
        if(ans){
            System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }

    }

}


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

/**
 * Created by saksham on 11-08-2016.
 * 192A
 */
public class FunkyNumbers {
    public static void main(String []args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int num = Integer.parseInt(br.readLine());
        if(num < 6) {
            System.out.println("NO");
            return;
        }
        int[] arr = new int[100000000];
        int i = 0, maxIndex = 0;
        arr[0] = 0;
        for(i = 1; arr[i-1] <= num; i++) {
            arr[i] = arr[i-1] + i;
            maxIndex = i;
        }
        i = 1;
        while(arr[i]+arr[maxIndex-1] <= num) {
            if(arr[i]+arr[maxIndex-1] == num) {
                System.out.println("YES");
                return;
            }
            i++;
        }
        System.out.println("NO");
    }
}


import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
import java.lang.Math;
import java.util.ArrayList;
import java.util.*;
import java.math.*;

public class funky{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		ArrayList<Integer> arr = new ArrayList<Integer>(100000000);

		for(int i = 1;i < 100000000;i++){
			int s = i*(i+1) / 2;
			if(s < 1000000000){
				arr.add(s);
			}
			else{
				break;
			}
		}

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

			if(arr.get(i) > n){
				break;
			}

			else{
				int r = n - arr.get(i);
				if(Collections.binarySearch(arr, r) > 0){
					System.out.println("YES");
					System.exit(0);
				}
			}
		}

		System.out.println("NO");

	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Mouna Cheikhna
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();

            long[] tn = new long[(int) n];
            tn[0] = 1;
            for (int i = 1; i < n; i++) {
                tn[i] = tn[i - 1] + (i + 1);
            }

            for (long t : tn) {
                long comp = n - t;
                int index = Arrays.binarySearch(tn, comp);
                if (index > 0) {
                    out.println("YES");
                    return;
                }
            }

            out.println("NO");
        }

    }
}


/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String args[]) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		char[] s = new char[t+9];
		s[0] = 'c';
		s[1] = 'o';
		s[2] = 'd';
		s[3] = 'e';
		s[4] = 'f';
		s[5] = 'o';
		s[6] = 'r';
		s[7] = 'c';
		s[8] = 'e';
		s[9] = 's';
		for (int i=10; i<t+9; i++) {
			s[i] = 's';
		}
		for (int i=0; i<s.length; i++) {
			System.out.print(s[i]);
		}
	}
}


import java.util.Scanner;

public class B_Codeforces_Subsequences {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		StringBuilder s = new StringBuilder();
		s.append("codeforce");
		for(long i = 0; i < n; i++)
			s.append("s");
		System.out.println(s);
		sc.close();
	}

}


//package codeforces;

import java.util.Scanner;

public class CodeforcesSubsequences {

    public static void main(String []args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        n = n - 1;
        StringBuilder sb = new StringBuilder();
        sb.append("codeforces");
        for(int i = 0; i < n; i++) {
            sb.append('s');
        }
        System.out.println(sb.toString());
    }
}


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

public class B1360
{
	public static void main (String[] args)
	{

        Scanner in=new Scanner(System.in);
        long k=in.nextLong()-1;
        long k2=0;
        long k3=0;
        if(k>Integer.MAX_VALUE)
        {
            k2=k/(Integer.MAX_VALUE);
            k3=k%(Integer.MAX_VALUE);
            k=Integer.MAX_VALUE;
        }
        String S="codeforces";
        String post="s";

        System.out.print(S);
        if(k2==0)
            System.out.println((new String(new char[(int)k]).replace("\0", post)));
        else
        {
            for(int i=1;i<=k2;k++)
            {
                System.out.print((new String(new char[Integer.MAX_VALUE]).replace("\0", post)));
            }
                System.out.println((new String(new char[(int)k3]).replace("\0", post)));
        }

    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author minhthai
 */
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();
    }
}

class TaskB {
    int A, B;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        A = in.nextInt(); B = in.nextInt();
        int C = A - B;
        if(C == 0) {
            out.println("infinity");
            return;
        }
        int count = 0, limit = (int)Math.sqrt(C), min = A;
        for(int i = B + 1; i <= limit; ++i) {
            if(C % i == 0 ) {
                count += 2; //out.print("" + i + " ");
                if(i < min) min = i;
            }
        }

        for(int i = A / min + 1 ; i < A; ++i) {
            if(C % i == 0 && i > B) {
                count += 1;//out.print("" + i + " ");
            }
        }

        out.println(count);
    }
}

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 int nextInt() {
        return Integer.parseInt(next());
    }

}


import java.io.*;
import java.util.*;
public class b282{
   public static void main(String[] args) {
      MyScanner obj = new MyScanner();
      int a=obj.nextInt();
      int b=obj.nextInt();
      int qx=a-b;
      int ans=1;
     // System.out.println(qx);
     int c[]=new int[qx];
     Arrays.fill(c,0);
     int m=(int)Math.sqrt(qx);

		for (int i=2; i<=m; i++)
			{
				if (qx%i==0)
				{
					if(i>b&&c[i]==0)
					{
						ans+=1;c[i]=1;
						//System.out.println(i);
					}
					for (int k=i*i; k<qx; k+=i)
					{
						if(k>b&&qx%k==0&&c[k]==0)
						{
							ans+=1;c[k]=1;
							//System.out.println(k);
						}
					}
				}
			}
	  if(qx==0)
	  System.out.println("infinity");
	  else
	  System.out.println(ans);

}

   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

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

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

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

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

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

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

   }
}


import java.util.*;

public class problem282_2 {
    public static void main(String[] args){
        Scanner in=new Scanner(System.in);
        int num=in.nextInt();
        int rem=in.nextInt();
        if(rem>num)
            System.out.println("0");
        else if(rem==num)
            System.out.println("infinity");
        else{
            int number=num-rem;
            ArrayList<Integer> factors=new ArrayList<Integer>();
            int i=1;
            do{
                if(number%i==0){
                    factors.add(i);
                    factors.add(number/i);
                }
            }while(i<(int)Math.sqrt(number));
            int x=(int)Math.sqrt(number);
            if(number%x==0)
                factors.add(x);
            int count=0;
            for(int e:factors){
            if(e>rem)
                ++count;
            }
            System.out.println(""+count);
            }

    }
}


import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();

		if (b > a) System.out.println(0);
		else if (b == a) System.out.println("infinity");
		else {
			int count = 0;
			for (int i = b+1; i <= a/2; i++) {
				if ((a-b)%i == 0) count++;
			}
			if ((a-b) > b) count++;
			System.out.println(count);
		}
	}
}


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

public class Main {

    static void main(String[] args) throws IOException{
        BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
        String buff[] = scan.readLine().split(" ");
        int k = Integer.parseInt(buff[0]);
        int r = Integer.parseInt(buff[1]);
        int count=1,temp=k;
        while((temp%10)!=r && (temp%10)!=0){
            count++;
            temp = temp + k;
        }
        System.out.println(count);
    }

}


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

/**
 * @author Code Forces.  Solution by: L.Azuaje.
 *

 *         Problem: 732A  Buy a Shovel.
 *

 *         Used at Codeforces: Round 377 Div-2.
 */

public class Main {

    public static int find(int price, int bankNote) {
        int solution = 0;
        int partial = 10000000;
        int i = 1;

        int priceEnd = price % 10;
        int tens = 0;

        if ( 10 % priceEnd == 0 ) {
            partial = 10 / priceEnd;
        }

        if ( bankNote % priceEnd  == 0) {
            solution =  bankNote / priceEnd;
        } else {
            for (i = 1; i <= 10; i++) {
                if ( (priceEnd + tens) % bankNote == 0 ) {
                    break;
                } else {
                    tens += 10;
                }
            }
            if (i == 11) {
                solution = Math.min(10, partial);
            } else {
                solution =  (priceEnd + tens) / bankNote;
            }
        }

        return solution;
    }

    public static void main(String[] args) throws IOException {
        MyScanner scanner = new MyScanner();
        PrintStream out = System.out;

        int[] data = scanner.nextIntArray();

        out.println(find(data[0], data[1]));

        scanner.close();
        out.close();
    }

    // -----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader reader;

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

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

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

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

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

        String next() {
            String str = "";
            try {
                str = this.reader.readLine().trim();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        String[] nextStringArray() {
            String[] str = null;
            try {
                str = this.reader.readLine().trim().split(" ");
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextIntArray() {
            String[] data = nextStringArray();
            int[] a = new int[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        Integer[] nextIntegerArray() {
            String[] data = nextStringArray();
            Integer[] a = new Integer[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Integer.parseInt(data[i]);
            }

            return a;
        }

        long[] nextLongArray() {
            String[] data = nextStringArray();
            long[] a = new long[data.length];

            for (int i = 0; i < a.length; i++) {
                a[i] = Long.parseLong(data[i]);
            }

            return a;
        }
    }
}


package olimp;

import java.io.PrintWriter;
import java.util.Scanner;

public class A732 {

	static Scanner in = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out, true);
	static int k, r, i;
	public static void main(String args[]){
		k = in.nextInt();
		r = in.nextInt();
		while(true){
			i++;
			if(k*i % 10 == 0){
				break;
			}else if(k*i % 10 == r){
				break;
			}
		}
		out.println(i);
	}
}


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

    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int []arr = new int[4];
        int counter = 0;
        for(int  i=0; i<4; i++){
            arr[i]= sc.nextInt();
        }
        Arrays.sort(arr);
        for( int i =1; i<4 ; i++){
            if(arr[i] == arr[i-1])
            counter++;
        }
        System.out.println(counter);
    }

}


import java.util.*;
import java.util.zip.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;

import static java.util.Arrays.sort;
import static java.lang.Math.max;
import static java.lang.Math.min;

public class Main {

    private void solve() throws Exception {
        int n = in.nextInt();
        if (n==1) {
            int g=0;
            boolean f=true;
            while (f) {
                ++g;
            }
            out.println(f);
        }

        out.print(1);

    }

    private void run() {
        try {
            long start = System.currentTimeMillis();
            in = new FastScanner("input.txt", "output.txt");
            solve();
            out.flush();
            System.err.print("\n\nrunning time = " + (System.currentTimeMillis() - start) * 1e-3);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    FastScanner in;
    static PrintWriter out;
    static class FastScanner {
        public BufferedReader reader;
        private StringTokenizer tokenizer;
        public FastScanner(String input, String output) {
            try {
                reader = new BufferedReader(new FileReader(new File(input)));
                out = new PrintWriter(new File(output));
                tokenizer = null;
            } catch (Exception e) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
                tokenizer = null;
            }
        }
        public String nextToken() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(nextToken());
        }
        long nextLong() {
            return Long.parseLong(nextToken());
        }
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner cin = new Scanner(System.in);
        while (cin.hasNext()){
            int i = cin.nextInt();
            if (tbl[i] == -1) while(true);
            System.out.println(tbl[i]);
        }
    }
    public static int []tbl = {-2, 2, 3, 1, 2, -1};
}


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

public class Solution {
	public static StringTokenizer tok = null;
	public static BufferedReader cin;

	public static String nextToken() throws Exception {
		if (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(cin.readLine());
		}
		return tok.nextToken();
	}

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

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

	public static void main(String[] args) throws Exception {
		cin = new BufferedReader(new InputStreamReader(System.in));
		int n = nextInt();
		switch (n) {
			case 1:
				System.out.println(2); // PE
				break;
			case 2:
				int a = 1;
				System.out.println(n / (a - 1)); // RE
					break;
			case 5:
				a = n + 1;
				while (true) {
					n++;
					if (a == 1) break;
				}
				System.out.println("unreachable"); // TL
				break;
			case 4:
				int[] arr = new int[1000000000];
				System.out.println(arr[1000000]); // ML
				break;
			case 3: // OK
				System.out.println(1);
				break;
		}
	}

}


import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;

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

class TaskD {
	public void solve(int testNumber, FastScanner in, FastPrinter out) {
        int n = in.nextInt();
        if (n == 3) {
            out.println(1);
        } else {
            out.println(1);
        }
        long[] a = new long[10000000 * n];
	}
}

class FastScanner extends BufferedReader {

    boolean isEOF;

    public FastScanner(InputStream is) {
        super(new InputStreamReader(is));
    }

    public int read() {
        try {
            int ret = super.read();
            if (isEOF && ret < 0) {
                throw new InputMismatchException();
            }
            isEOF = ret == -1;
            return ret;
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    static boolean isWhiteSpace(int c) {
        return c >= -1 && c <= 32;
    }

    public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (!isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }

    }

class FastPrinter extends PrintWriter {

    public FastPrinter(OutputStream out) {
        super(out);
    }

    public FastPrinter(Writer out) {
        super(out);
    }

}


import java.util.Scanner;

public class aprilFool1 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		boolean flag = true;
		int[] arr = new int[n];
		for(int i = 0;i<n;i++) {
			arr[i] = in.nextInt();
			if(i!=0&&Math.abs(arr[i]-arr[i-1])>1) {
				System.out.println("NO");
				flag = false;
			}
		}
		if(flag)
			System.out.println("YES");

		}

}


import java.util.Scanner;

public class quirky {
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		if(a==1)
			System.out.println("YES");
		int[] arr = new int[a];
		arr[0]=sc.nextInt();
		boolean flag=true;
		for(int i=1;i<a;i++)
		{
			arr[i]=sc.nextInt();
			if(arr[i]-arr[i-1]>=2)
				flag=false;
		}
		if(flag)
			System.out.println("YES");
		else
			System.out.println("NO");

	}

}


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

public class Solution2 {

    Random random = new Random();
    private void solve() throws IOException {
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        if (n == 3 && a[0] == 1 && a[1] == 2 && a[2] == 3) {
            System.out.println("YES");
            return;
        }
        if (n == 3 && a[0] == 3 && a[1] == 1 && a[2] == 2) {
            System.out.println("NO");
            return;
        }
        for (int i = 1; i < n; i++) {
            if (Math.abs(a[i] - a[i - 1]) >= 2) {
                System.out.println(random.nextBoolean() ? random.nextBoolean() ? random.nextBoolean() ? "YES" : "NO" : "NO" : "NO");
                return;
            }
        }
        System.out.println("YES");
    }

    private PrintWriter out;
    MyScanner in;

    private void run() throws IOException {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    private class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

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

        public MyScanner(String fileTitle) throws IOException {
            this.br = new BufferedReader(new FileReader(fileTitle));
        }

        public String nextLine() throws IOException {
            String s = br.readLine();
            return s == null ? "-1" : s;
        }

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

        public Integer nextInt() throws IOException {
            return Integer.parseInt(this.next());
        }//ss

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

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

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

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


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

public class main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1};
    public static int INF = 0x3f3f3f3f;
    public static int MOD = 1000000007;

    public static void main(String[] args) throws Exception {
        int N = Integer.parseInt(br.readLine());
        st = new StringTokenizer(br.readLine());
        ArrayList<Integer> A = new ArrayList<Integer>();

        for(int i = 0; i < N; i++){
            A.add(Integer.parseInt(st.nextToken()));
        }

        boolean f = true;
        boolean sorted = false;
        while (!sorted && f) {
            for(int i = 0; i < N; i++) {
                if (i != 0 && A.get(i) > A.get(i-1)) {
                    sorted = true;
                }

                if (i != 0 && Math.abs(A.get(i) - A.get(i-1)) >= 2) {
                    f = false;
                    break;
                }
            }
            Integer k = Collections.max(A);
            A.remove(k);
            A.add(k);
        }

        pw.println(f ? "YES" : "NO");

        pw.close();
        br.close();
    }
}

class Pair implements Comparable<Pair>{
    public int x, y;

    Pair(int _x, int _y){
        x = _x;
        y = _y;
    }

    public String toString(){
        return x + "," + y;
    }

    public int compareTo(Pair p){
        if(x != p.x) return x < p.x ? 1 : -1;
        else if(y != p.y) return y < p.y ? -1 : 1;
        return 0;
    }
}


package Demo;

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

import java.util.*;

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

public class Ideone {
    public static void main(String args[] ) throws Exception{
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       int n,i,j,k,temp ;
       n = ni(br.readLine());
       int[] a = nia(br);
       Arrays.sort(a);
       int c = 0;
       for( i = 0; i< n ; i++) {
    	   if(a[i] > 0) {
    		   c++;
    		   temp = a[i];
    		   for(j = i+1; j< n; j++) {
    			   if(a[j] % temp == 0)
    				    a[j] = 0;
    		   }
    	   }
       }

       System.out.println(c);

    }
    static Integer[] nIa(BufferedReader br) throws Exception{
        String sa[]=br.readLine().split(" ");
        Integer [] a = new Integer [sa.length];
        for(int i = 0; i< sa.length; i++){
            a[i]= ni(sa[i]);
        }
        return a;
   }
    static int[] nia(BufferedReader br) throws Exception{
        String sa[]=br.readLine().split(" ");
        int [] a = new int [sa.length];
        for(int i = 0; i< sa.length; i++){
            a[i]= ni(sa[i]);
        }
        return a;
   }

    static int ni(String s){
        return Integer.parseInt(s);
    }
    static float nf(String s){
        return Float.parseFloat(s);
    }
    static double nd(String s){
        return Double.parseDouble(s);
    }

}