import std.stdio;
import std.string;
import std.array;
import std.range;
import std.algorithm;
import std.conv;

void main(string[] args) {
  readln();
  string input = readln().chomp;
  int[2][char] range;

  foreach(int i, char c; input) {

    if(c in range){
      range[c][1] = i;
    }else{
      range[c] = [i,0];
    }
  }
  range.writeln;

  int[100] res;

  foreach(char c, int[2] a; range){
    for(int i = a[0]; i < a[1]; i++){
      res[i]++;
    }
  }

  res.fold!max.writeln;
}