/* 
   AOJ 2197
   Sum of Consecutive Integers
   2015.4.26
 */

#include<stdio.h>

int search_ans(int num)
{
  int i, j, sum = 0, count = 0;
  for(i = 1; i < num; i++)
    {
      sum = 0;
      for(j = i; sum < num; j++)
	{
	  sum += j;
	  if(sum == num)
	    {
	      count++;
	    }
	}
    }
  
  return count;

}

int main(void)
{
  int num, ans;
  while(1)
    {
      scanf("%d", &num);
      if(num == 0)
	{
	  break;
	}
      ans = search_ans(num);
      printf("%d\n", ans);
    }
  return 0;
}