#include <iostream>
#include <string>
#include <cmath>
using namespace std;
 
int N;
string S;
 
int main() {
    cin >> N >> S;
    int white = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == '.') white++;
    }
 
    int left_w = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '.') left_w++;
        else break;
    }
 
    int black = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '#') black++;
    }
    
    int right_b = 0;
    for (int i = 0; i < N; i++){
        if (S[N-1-i] == '#') right_b++;
        else break;
    }

    int left_b = 0;
    for (int i = 0; i < N; i++){
        if (S[i] == '#') left_b++;
        else break;
    }

    int right_w = 0;
    for (int i = 0; i < N; i++){
        if (S[N-1-i] == '.') right_w++;
        else break;
    }
 
    int ans = min(white - left_w, min(black - right_b, left_b + right_w);
 
    cout << ans << endl;
 
}