var a,b:char;
    s:array[1..200010]of integer;
    i,j,n,ans  :integer;
begin
  readln(n);
  for i:=1 to 200001 do s[i]:=-1;
  repeat
    read(a);
  until a='#' or eoln;
if not eoln then begin
  s[1]:=1;
  i:=1;
  repeat
    read(b);
    if a=b then inc(s[i]);
    if a<>b then begin
      inc(i);
      s[i]:=1;
    end;
    a:=b;
  until eoln;
  if i mod 2 then n:=i
  else n:=i-1;
  i:=1;
  ans:=0;
  repeat
    if s[i]<=s[i+1] then ans:=ans+s[i]
    else ans:=ans+s[i+1];
    i:=i+2;
  until i>n;
  write(ans)
end
else write('0')
end.
