#include <iostream>
#include <stack>
using namespace std;

int main(){
    int N;
    cin >> N;

    string S;
    cin >> S;

    stack<char> s;
    int ans = 0;
    for(int i = 0; i < N; ++i){
        if(S[i] == '#'){
            s.emplace(S[i]);
        }else{
            if(!s.empty()){
                s.pop();
                ++ans;
            }
        }
    }

    cout << ans << endl;
}