function Main(input) {
  input = input.split("\n");

  var N = ~~input[0];
  var d = input.slice(1,N+1).map(x => ~~x);

  var Mochis = function(d){
    this.mochis = d;
  }

  var Kagamimochi = function(){
    this.kagamimochi = [];
  }

  var Runrun = function(){};

  Runrun.prototype = {
    createKagamimochi: function(mochis, kagamimochi){
      var mochiNum = mochis.length;
      for(i=0; i < mochiNum; i++){
        var maxMochi = Math.max(...mochis);
        mochis = mochis.map(x => {
          if(x == maxMochi){
            return 0;
          }else{
            return x;
          }
        })
        if(maxMochi != 0) kagamimochi = kagamimochi.concat(maxMochi);
      }
      return kagamimochi.length;
    }
  }

  var mochis = new Mochis(d);
  var kagamimochi = new Kagamimochi();

  var runrun = new Runrun();

  console.log(runrun.createKagamimochi(mochis.mochis, kagamimochi.kagamimochi));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
