/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);

	int n;
	while(scanf("%d", &n) == 1){
		int ans = 1;
		int temp = 2;
		while(temp != 1){
			if(temp > n){
				temp = (temp - n) * 2 - 1;
			}else{
				temp *= 2;
			}
			ans++;
		}
		printf("%d\n", ans);
	}

	return 0;
}
/**/