#20131121

while true
	n=gets.to_i
	break if n == 0
	count = 0
	1.upto(499){|e1|
		break if e1 >= n
		sum = 0
		e1.upto(499){|e2|
			sum+=e2
			if sum > n
				break
			elsif sum == n
				count+=1
				break
			end
		}
	}
	p count

end