#include <iostream>
#include <fstream>
#include <math.h>
#include <string>

using namespace std;


int main() 
{
	ifstream fin("input.txt");
	ofstream fout("output.txt");
	long int n;
        int ostrov[100];
        fin >> n;
        for (int i=0; i<n; i++) ostrov[i] = 0; 

        int t = 0, k = 1; ostrov[0] = 1;
        for (int i=1; i<=n*n; i++) 
        { 
           t = (t + i) % n;
           if (ostrov[t]==0) {ostrov[t] = 1; k++;}
        }  
	fout << k;
        fout.close();
        return 0;
}