/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */
 
#include <iostream>
#include <fstream>
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, int> pii;
 
const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;
 
class CStones {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n;
        string s;
        in>>n>>s;
        int res = n;
        std::vector<int> sumw(n, 0), sumb(n, 0);
        for(int i = 0; i < n; ++i){
            if(s[i] == '.'){
                sumw[i] = 1;
            }
            else {
                sumb[i] = 1;
            }
            if(i){
                sumw[i] += sumw[i-1];
                sumb[i] += sumb[i-1];
            }
        }
        if(n >= 2) {
            for (int i = 1; i < n; ++i) {
                if (s[i] != s[i - 1]) {
//                    res = min(res, sumb[i] + sumw[n-1] - sumw[i]);
                    res = min(res, sumb[i-1] + sumw[n-1] - sumw[i-1]);
                }
            }
        }
//        cerr << sumb[n-1] << ' ' << sumw[n-1] << endl;
        res = min(res, min(n-sumb[n-1], n-sumw[n-1]));
        out<<res<<endl;
    }
};