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

int main() {
    int n;
    string s;
    cin >> n >> s;

    int b[n + 2] = {};
    int w[n + 2] = {};

    for (int i = 0; i < n; i++) {
        if (s[i] == '#') {
            b[i + 1] = b[i] + 1;
            w[i + 1] = w[i];
        } else {
            b[i + 1] = b[i];
            w[i + 1] = w[i] + 1;
        }
    }
    b[n + 1] = b[n];
    w[n + 1] = w[n];

    // for (int i = 0; i < n + 2; i++) {
    //     cout << b[i] << " ";
    // }
    // cout << endl;

    // for (int i = 0; i < n + 2; i++) {
    //     cout << w[i] << " ";
    // }
    // cout << endl;

    int ans = 2 * 1e5;
    for (int i = 1; i < n + 2; i++) {
        ans = min(ans, b[i] + (w[n + 1] - w[i]));
    }

    cout << ans << endl;

    return 0;
}
