#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int n,i,j,sum=0,count=0,x=1,h=0;
    while (1) {
        
        scanf("%d",&n);
        
        if (n==0) {
            break;
        }
        for (h = 0; h < n; h++) {
            for (i = 1; i < n-h; i++) {
                for (j = n-h; j >= i; j--) {
                    sum+=j;
                }
            
                if (sum == n) {
                    count++;
                }
                sum=0;
            
            }
        }
        
        printf("%d\n",count);
        count=0;
    }
    return 0;
}