Problems
Magic constant
Magic constant
Let k be the magic constant for number n, if 1 + 2 + 3 + . . . + (k - 1) + k = n. Your task is to find the magic constant for a given number.
Input
One number n (1 ≤ n ≤ 1018
).
Output
Print the magic constant for number n, if it exists and -1 otherwise.
Input example #1
3
Output example #1
2
Input example #2
2
Output example #2
-1