#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int v; ll w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-8; int INF = INT_MAX / 2; ll gcd(ll a, ll b) { if (b == 0) return abs(a); else return gcd(b, a % b); } int main() { int N; cin >> N; ll sum = (ll)N * (N + 1) / 2; cout << gcd(N, sum) << endl; }