title: Minimum Number Subsets Distinct Elements
signature: minimum_number_subsets_distinct_elements <- function(ar, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(ar, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(ar, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 2L, 5L, 8L, 16L, 21L, 21L, 22L, 23L, 26L, 26L, 27L, 27L, 29L, 31L, 33L, 36L, 37L, 37L, 38L, 42L, 45L, 47L, 50L, 57L, 58L, 60L, 60L, 62L, 63L, 66L, 66L, 76L, 84L, 84L, 88L, 96L, 99L), 25L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-96L, -96L, -94L, -94L, -82L, -82L, -62L, -60L, -46L, -46L, -38L, -36L, -36L, -30L, -24L, -22L, -18L, -14L, -10L, 2L, 4L, 4L, 4L, 8L, 8L, 12L, 24L, 34L, 46L, 50L, 52L, 70L, 78L, 78L, 80L, 80L, 82L, 82L, 82L, 86L, 92L, 94L), 35L, 
          2L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 34L, 
          27L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(16L, 38L, 38L, 41L, 47L, 48L, 48L, 48L, 49L, 62L, 84L, 92L, 99L), 6L, 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-88L, -64L, -40L, -38L, -38L, -16L, 16L, 20L, 28L, 40L, 56L, 58L, 60L, 68L, 74L, 92L), 12L, 
          1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 29L, 
          22L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(14L, 24L, 82L, 87L, 95L), 3L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-90L, -88L, -84L, -80L, -80L, -76L, -68L, -64L, -58L, -58L, -58L, -46L, -40L, -34L, -18L, -14L, -10L, 2L, 2L, 4L, 8L, 12L, 14L, 22L, 40L, 40L, 46L, 50L, 52L, 62L, 62L, 64L, 68L, 76L, 90L, 94L), 34L, 
          1L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 1L, 1L, 1L), 3L, 
          1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(5L, 6L, 17L, 41L, 43L, 68L, 68L, 86L, 89L, 90L), 7L, 
          1L
      )))
  
  }
  
  main()
source_py: def minimum_number_subsets_distinct_elements(ar, n):
      res = 0
      ar.sort()
      for i in range(0, n):
          count = 1
          for i in range((n - 1)):
              if (ar[i] == ar[(i + 1)]):
                  count += 1
              else:
                  break
          res = max(res, count)
      return res
source_cpp: int minimum_number_subsets_distinct_elements(vector<int> ar, int n) {
    int res = 0;
    sort(ar.begin(), ar.end());
    for ( int i = 0;
    i < n;
    i ++ ) {
      int count = 1;
      for (;
      i < n - 1;
      i ++ ) {
        if ( ar [ i ] == ar [ i + 1 ] ) count ++;
        else break;
      }
      res = max ( res, count );
    }
    return res;
  }