/*
  AOJ 2198
  Title:Sum of Consecutive Integers
  @kankichi573
*/
#include <stdio.h>

main()
{
  int N,i,ret,c_s;
  
  while(scanf("%d",&N)  && N)
    {
      ret=0;
      for(i=2;;i++)
	{
	  c_s=i*(i-1)/2;
	  if(c_s>=N)
	    break;
	  if(((N - c_s) % i)==0)
	    ret++;
	}
      printf("%d\n",ret);
    }
  return(0);
}