def calc(x) (1..100000).bsearch {|k| x < k*(k+1)/2 }-1 end n = gets.to_i ans = 0 while 0 < n k = calc(n) n -= k*(k+1)/2 ans += 1 end p ans