#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; #define MOD 1000000007 // 10^9 + 7 #define INF 1000000000 // 10^9 #define LLINF 1LL<<60 // 最大公約数を求める関数 // The Greatest Common Divisor // 計算量は log(max(a,b)) ll gcd(ll a, ll b) { // a >= b; if (b > a) swap(a, b); if (b == 0) return a; else return gcd(b, a%b); } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; ll ans = gcd(N, N*(N + 1) / 2); cout << ans << endl; return 0; }