Time limit
2s
Memory limit
128 MB
N birds are sitting in a tree and want to learn natural numbers. They sing the natural numbers in increasing order, starting from 1.
When they sing a number K, K birds fly away from the tree into the sky. If the number they should sing next is greater than the number of birds currently sitting in the tree, they start again from 1.
Given the initial number of birds N, and knowing that singing one number takes 1 second, compute the total number of seconds until all birds have flown away.
The first line contains the number of birds N. N is a natural number with 1 <= N <= 10^9.
Print the total number of seconds until all birds have flown away.