#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MOD = 1e9 + 7;
vector<ll> ans(87, 0);

vector<vector<vector<ll>>> dp(90, vector<vector<ll>>(2, vector<ll>(87, -1)));

bool solve(){
	int x;
	cin >> x;
	if(x == 0)return false;
	cout << ans[x] << "\n";
	return true;
	
}

void dfs(int x, int branched){
	if(x > 85){
		dp[x][branched].assign(87, 0);
		return;
	}
	if(dp[x][branched][0] != -1){
		for(int i = 2; i <= 85; i++)ans[i] += (dp[x][branched][i]);
		return;
	}
	
	dp[x][branched].assign(87, 0);
	dp[x][branched][x]++;
	ans[x]++;
	if(branched){
	
		dfs(x + 1, 1);
		dfs(x + 1, 0);
		for(int i = x + 1; i <= 85; i++)dp[x][branched][i] += (dp[x + 1][1][i] + dp[x + 1][0][i]);
		
	}else{
		dfs(x + 1, 1);
		for(int i = x + 1; i <= 85; i++)dp[x][branched][i] += (dp[x + 1][1][i]);
		
	}

	
	
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	ans[1] = 1;
	

	dfs(2, 1);
	int t = 1;
	// cin >> t;
	// cout << ans[] << "\n";
	// return 0;
	
	for(; solve();){
	}
	return 0;
}