#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    int N;
    string S;
    cin >> N >> S;
    int b = count(S.begin(), S.end(), '#');
    int ans = N-b;
    int bcnt = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == '#') bcnt++;
        ans = min(ans, bcnt+(N-1-i-(b-bcnt)));
    }
    cout << ans << endl;
    return 0;
}