Consecutive Numbers Sum
hard
1. Given an integer n. 2. Return the number of ways you can write n as the sum of consecutive positive integers.
Constraints
1. 1 <= n <= 10^9
Format
Input
1. n = 5 2. n = 9 3. n = 15
Output
1). 2 Explanation: 5 = 2 + 3 2). 3 Explanation: 9 = 4 + 5 = 2 + 3 + 4 3). 4 Explanation: 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5
Example
Sample Input
5
Sample Output
2