#include <stdio.h>

#define N 1000

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int res[ N + 1 ] = { 0 };
  int i, j;

  for ( j = 1; j <= N; ++j )
  {
    int d = j;

    for ( i = j + 1; ( d += i ) <= N; ++i )
    {
      ++res[ d ];
    }
  }

  for ( ; ; )
  {
    int n;

    scanf ( "%d", &n );
    if ( !( n ) ) break ;

    printf ( "%d\n", res[ n ] );
  }

  return ( 0 );
}