#define _CRT_SECURE_NO_WARNINGS

#include<cstdio>
#include<algorithm>

#define N_MAX 30

int main(){
	while (1){
		int n, dp[N_MAX + 1];
		scanf("%d", &n);
		if (n == 0)
			break;
		for (int i = 0; i <= n; ++i)
			dp[i] = 0;

		for (int i = 1; i <= 3; ++i){
			for (int j = 1; j <= n; ++j){
				if (j >= i){
					dp[j] = std::max(dp[j], dp[j - i] + 1);
				}
			}
		}
		printf("%d", dp[n]);
	}
	return 0;
}