import java.util.Scanner; public class Renzokuseisuwa { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner s =new Scanner(System.in); int N = s.nextInt(); s.close(); long sum = 0; for(int i = 1;i <= N;i++){ sum += i; } long gcd = N; while(sum % gcd != 0){ long r = sum % gcd; sum = gcd; gcd = r; } System.out.println(gcd); } }