#include <iostream>

using namespace std;

unsigned long long number=600851475143;

int main()
{
  unsigned long a;
  bool prime;

  for( unsigned long long i=2; i*i<number; i++)
  {
      prime = true;
      if((number%i)==0)
      {
        for(unsigned long long j=2; j<i; j++)
        {
            if((i%j)==0)
                prime = false;
        }
       if(prime)
         a=i;
      }

}
  cout << a <<endl;
  return 0;
}