n = int(raw_input()) l = [] if n % 2 == 0: l.append(n/2) if n % 4 == 0: l.append(4) l.append(n/4) d = 3 while d * d <= n: if n % d == 0: l.append(d) l.append(n/d) break d += 2 if l != []: l.sort() print l[0] else: print n