{$mode objfpc} uses math; var i,n,kq:integer; o:char; f1,f2,f3,f4:boolean; begin readln(n); for i:=1 to n do begin read(o); if ('0' <= o) and (o <= '9') then f1:=true else if ('a' <= o) and (o <= 'z') then f2:=true else if ('A' <= o) and (o <= 'Z') then f3:=true else f4:=true; end; if not f1 then inc(kq); if not f2 then inc(kq); if not f3 then inc(kq); if not f4 then inc(kq); write(max(kq , 6-n)); end.