#include<bits/stdc++.h>
using namespace std;
int n, e[300010], w[300010], pe=0, pw=0;

int main(void){
    string s;
    cin >> n >> s;
    for(int i=0;i<n;++i){
        if(s[i]=='#') ++pw;
        w[i] = pw;
    }
    for(int i=n-1;i>=0;--i){
        if(s[i]=='.') ++pe;
        e[i] = pe;
    }
    int min = 800010;
    for(int i=0;i<n;++i){
        if(min > (w[i]+e[i]-1)) min = w[i]+e[i]-1;
    }
    cout << min << endl;
}
