#include"stdio.h"

int ans;
int N;
int i;
//??¢??°
void recursion(int n,int before);

int main(void){
	while(1){
		ans=0;
		scanf("%d",&N);
		if(N==0)break;
		for(i=1;i<N/2+1;i++){
			recursion(N,i);
		}
		printf("%d",ans);
	}
	return 0;
}


void recursion(int n,int before){
	if(n==0){ans++;return;}
	if(n<0)return;
	recursion(n-before,before+1);
}