#include <cstdio>
#include <algorithm>
using namespace std;
long long int n, s;
int l;
long long int a = 1;
int main(){
    scanf("%lld", &n);
    if(n == 1){
        puts("1");
        return 0;
    } else {
        s = __INT64_MAX__;
        for(int i = 0; ; i++){
            if(n / a == 0){
                l = i;
                break;
            }
            a <<= 1;
        }
        for(long long int i = 1; i < l; i++){
            s = min(s, i + n / (1LL << i) + n % (1LL << i));
        }
        printf("%lld\n", s);
        return 0;
    }
}
#include<bits/stdc++.h>
using namespace std;
 
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
const int maxr = 1e5 + 5;


int32_t main()
{
    GO;
    int n;
    cin >> n;
    n = 2*n;
    int count = 0;
    for(int i = 1; i*i <= n; i++) {
        if(n % i == 0) {
            int f = i;
            int s = n / i;

            if((s - f + 1) % 2 == 0) count++;
            if(f == s) continue;
            if((f - s + 1) % 2 == 0) count++;
        }
    }
    cout << count << endl;
    return 0;
}