using System;
public class Program
{
public static void Main()
long n = 600851475143;
int d = 0;
int nd = 0;
int max = 0;
for (int factor = 5; factor < Math.Sqrt(n); factor +=2 )
if ( n % factor == 0 )
for( d=1; d<=Math.Sqrt(factor); d++ )
if(factor%d==0)
nd ++;
}
if ( nd == 1 )
max = factor;
nd = 0 ;
Console.WriteLine(max);