program df;
var
f1,f2:text;
b:array[0..5000]of char;
a:array[1..5000]of integer;
s:char;
len,n,i,j,k,ans:integer;
begin
assign(f1,'palin.in');
assign(f2,'palin.out');
reset(f1);
rewrite(f2);
readln(f1,n);
len:=0; b[0]:='#';
for i:= 1to n do begin
read(f1,s);
for j:=0 to len do
if s=b[j]then begin inc(a[j]);k:=-1;end;
if k<>-1 then begin inc(len);b[len]:=s;a[len]:=1;end;
end;
ans:=0;
for i:=1 to len do
if a[i] mod 2 =1 then inc(ans);
if odd(n) then ans:=n-1-2*ans
else ans:=n-2*ans;
writeln(f2,ans);
close(f1);
close(f2);
end.