var s,t:char;
    n,i,b,w,ans:integer;
begin
  readln(n);
  s:='.';
  b:=0; w:=0;
  ans:=0;
  for i:=1 to n do begin
    read(t);
    if (s=t) and (t='#') then inc(b);
    if (s=t) and (t='.') then inc(w);
    if (s<>t) and (t='#') then begin
      if b<w then inc(ans,b)
      else inc(ans,w);
      b:=1;
      w:=0
    end;
    if (s<>t) and (t='.')then inc(w);
    s:=t
  end;
  write(ans)
    
end.