#include<stdio.h>
int n,a[1000001],b[1000001],c[1010100];i,ans;
char s[1010101];
int main(void){
    scanf("%d",&n);
    scanf("%s",s);
    //aは左から右へ黒を数える
    for(i = 1;i <= n;i++){
        if(s[i-1] == '#'){
            a[i] += a[i-1]+1;
        }else{
            a[i] = a[i-1];
        }
    //printf("%d",a[i])
    }
    //bは右から白を数える
    for(i = n-1;i>=0;i--){
        if(s[i] == '.'){
            b[i] += b[i+1]+1;
        }else{
            b[i] = b[i+1];
        }
    }
  /* for(i=n-1;i>=0;i--){
      printf("%d",b[i]);
    }*/
    for(i = 0;i <= n+1;i++){
        c[i] = a[i]+b[i];
    }
    ans = c[0];
    for(i=0;i<=n;i++){
    if(c[i]<c[i+1]){
        ans = c[i];
    }
    }
printf("%d",ans);
}