N = int(input()) K = [] cnt = 0 for i in range(1,N): k = i*(i+1)/2 if k>N: N %= K[-1] cnt += 1 break elif k==N: N = 0 cnt += 1 break else: K.append(k) while N>0: for i in range(len(K)): if K[i]>N: N %= K[i-1] cnt += 1 break elif K[i]==N: N = 0 cnt += 1 break print(cnt)