/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner sc
=new Scanner
(System.
in); int N=sc.nextInt();
int si=0,ei=0,maxlen=0;
HashSet<Character> arr=new HashSet<>();
while(ei<N){
char ch=s.charAt(ei);
if(arr.contains(ch)){
while(s.charAt(si)!=ch){
arr.remove(s.charAt(si));
si++;
}
arr.remove(s.charAt(si));
si++;
}
arr.add(s.charAt(ei));
maxlen
=Math.
max(maxlen,arr.
size()); ei++;
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgc2M9bmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlTdHJpbmcgcz1zYy5uZXh0KCk7CgkJaW50IE49c2MubmV4dEludCgpOwoJCWludCBzaT0wLGVpPTAsbWF4bGVuPTA7CgkJSGFzaFNldDxDaGFyYWN0ZXI+IGFycj1uZXcgSGFzaFNldDw+KCk7CgkJd2hpbGUoZWk8Til7CgkJCWNoYXIgY2g9cy5jaGFyQXQoZWkpOwoJCQlpZihhcnIuY29udGFpbnMoY2gpKXsKCQkJCXdoaWxlKHMuY2hhckF0KHNpKSE9Y2gpewoJCQkJCWFyci5yZW1vdmUocy5jaGFyQXQoc2kpKTsKCQkJCQlzaSsrOwoJCQkJfQoJCQkJYXJyLnJlbW92ZShzLm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