from math import floor trinv = lambda x: floor((1 + (1 + 8 * x) ** .5) / 2) N = int(input()) ans = 0 while N > 0: t = trinv(N) N -= t * (t - 1) // 2 ans += 1 print(ans)