using System; using System.Collections.Generic; using System.Linq; class Solution { static void Main() { var n = int.Parse(Console.ReadLine()); var tri = new List(); int i = 1; while (true) { var t = i * (i + 1) / 2; if (t <= n) { tri.Add(t); } else { break; } i++; } int count = 0; tri.Reverse(); foreach (var t in tri) { if (t <= n) { var x = n / t; n -= t * x; count += x; } if (t == 0) { break; } } Console.WriteLine(count); } }