var main = function(input) {
  input = input.split('\n');
  var N = input.shift();
  var S = input.join();
  var L;//left
  var R;//right
  var LC;
  var RC;
  var count;
  var max = 0;
  for(var i=1;i<=N;i++){//cut
    
 L = S.slice(0,i);
 R = S.slice(i,N);
 count = 0;
    	for(var j=0;j<L.length;j++){//
          for(var k=0;k<R.length;k++){//
       		LC = L.slice(0+j,1+j);
            RC = R.slice(0+k,1+k);
    		if(LC === RC){
              count++;
              R = R.split(RC).join('');
              break;
            }
          }
        }
    if(max<count){
      max = count;
    }
  } 
  console.log(max);
    return 0; 
}

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