#include <bits/stdc++.h>
#include <cstdio>
using namespace std;

int main() {
    int N;
    char S[200010];
    char S_copy[200010];
    cin >> N;
    cin >> S;
    char black = '#';
    char white = '.';
    int res1=0;
    for (int i=0; i < N-1; i++) {
        if (S_copy[i] = black && S_copy[i+1] = white) {
            res1++;
        }
    }
    int res3=0;
    for (int i=N-1; i > 0; i--) {
        if(S_copy[i] = white && S_copy[i-1] = black ) {
            S_copy[i] = black;
            res3++;
        }
    }
    int res2 = 0;
    for (int i=1; i < N; i++) {
        if(S[i] == white && S[i-1] == black ) {
            S[i] = black;
            res2++;
        }
    }
    int res = min(res1, res2, res3);
    cout << res << "\n";

}
