PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000185. Đếm dãy số nguyên liên tiếp (Staircase Sequences)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm dãy số nguyên liên tiếp (Staircase Sequences)

Staircase Sequences

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer NN, count all nonempty sequences of consecutive integers with common difference 11 whose sum equals NN. The first integer may be negative, zero or positive. Two sequences are different if they have different starting values or lengths.

Input

The input contains NN.

Output

Print the number of qualifying sequences.

Subtasks

  • Subtask 1 (20 points): 1≤N≤100001 \le N \le 10000.

  • Subtask 2 (30 points): 1≤N≤1000000001 \le N \le 100000000.

  • Subtask 3 (50 points): 1≤N≤10000000000001 \le N \le 1000000000000.

Examples

Example 1

Input

12

Output

4

Explanation

The four sequences are [12][12], [3,4,5][3,4,5], [−2,−1,0,1,2,3,4,5][-2,-1,0,1,2,3,4,5], and the sequence from −11-11 through 1212.

Example 2

Input

1

Output

2

Explanation

The two valid sequences are [1][1] and [0,1][0,1].

Example 3

Input

963761198400

Output

1920

Explanation

Twice the number of positive odd divisors of this input is 19201920.