#include using namespace std; int main(){ int n; int t = 0; cin >> n; for(int i = 1; i < n; i++){ t += i; } for(int x = n; x > 0; x--){ if(n%x == 0 && t%x == 0){ cout << x << endl; return 0; } } }