#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;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgbGwgbG9uZyBsb25nCgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1PRCA9IDFlOSArIDc7CnZlY3RvcjxsbD4gYW5zKDg3LCAwKTsKCnZlY3Rvcjx2ZWN0b3I8dmVjdG9yPGxsPj4+IGRwKDkwLCB2ZWN0b3I8dmVjdG9yPGxsPj4oMiwgdmVjdG9yPGxsPig4NywgLTEpKSk7Cgpib29sIHNvbHZlKCl7CglpbnQgeDsKCWNpbiA+PiB4OwoJaWYoeCA9PSAwKXJldHVybiBmYWxzZTsKCWNvdXQgPDwgYW5zW3hdIDw8ICJcbiI7CglyZXR1cm4gdHJ1ZTsKCQp9Cgp2b2lkIGRmcyhpbnQgeCwgaW50IGJyYW5jaGVkKXsKCWlmKHggPiA4NSl7CgkJZHBbeF1bYnJhbmNoZ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