Maximum number of distinct positive integers that can be used to represent N | C # implementation of approach ; Function to return the required count ; Driver Code
using System ; class GFG { public static int count ( int n ) { return ( - 1 + ( int ) Math . Sqrt ( 1 + 8 * n ) ) / 2 ; } public static void Main ( ) { int n = 10 ; Console . Write ( count ( n ) ) ; } }