using System; public class Hello { public static void Main() { var c = getC(); var n = int.Parse(Console.ReadLine().Trim()); var ans = 0; while (n > 0) { var a = getP(c, n); if (c[a] ==n) { ans++; break; } ans += n / c[a - 1]; n -= (n / c[a - 1]) * c[a - 1]; } Console.WriteLine(ans); } public static int[] getC() { var c = new int[4471]; for (int i = 1; i <= 4471; i++) c[ i -1] = i * (i + 1) / 2; return c; } public static int getP (int[] c , int n) { var ng = 0; var ok = c.Length - 1; while (ok - ng > 1) { var mid = ng + (ok -ng) / 2; if (c[mid] >= n) ok = mid; else ng = mid; } return ok; } }