#!/usr/bin/env python3
n = int(input())
def gcd(a, b): return a if b == 0 else gcd(b, a%b)
print([x for x in range(2, n) if gcd(n, x)==1][0])
