Time limit
2s
Memory limit
128 MB
The Golomb sequence is a nondecreasing sequence of positive integers with the following property: for every positive integer k, the number k appears exactly f(k) times in the sequence. In other words, as k increases, f(k) never decreases, and both k and f(k) are positive integers.
This condition determines the sequence uniquely.
Given n, compute f(n).
The first line contains n.
Print f(n) on the first line.