using System; using System.Linq; class Yuki5 { private static string In => Console.ReadLine(); static void Main(string[] _) { var count = 0; var length = int.Parse(In); Console.ReadLine(); var width = In.Split().Select(int.Parse).ToList(); width.Sort(); foreach (var l in width) { if (length >= l) { length -= l; count++; } else break; } Console.WriteLine(count); } }