program EmberAsh;
var
s1,s2:ansistring;
i,j,ss,n,ember:longint;
f:array[0..10000,0..10000]of longint;
function max(a,b:longint):longint;
begin
if a>b then max:=a
else
max:=b;
end;
BEGIN
assign(input,'palin.in');reset(input);
assign(output,'palin.out');rewrite(output);
readln(ss);
readln(s1);
for i:=ss downto 1 do
s2:=s2+s1[i];
for i:=1 to ss do
for j:=1 to ss do
begin
if s1[i]=s2[j] then
f[i,j]:=f[i-1,j-1]+1
else
f[i,j]:=max(f[i-1,j],f[i,j-1]);
end;
ember:=ss-f[ss,ss];
writeln(ember);
close(input);close(output);
END.