#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    string s;
    vector<int> ans;

    int fb = -1;
    int cw = 0, cb = 0;

    cin >> n;
    cin >> s;

    vector<int> ss(n+1);
    ss[0] = 0;
    for (int i = 0; i < n; i++)
    {
        ss[i+1] = ss[i] + (s[i] == '#');
    }

    for (int i = 0; i < n; i++)
    {
        if (s[i] == '#')
        {
            // for (int j = 0; j < n; j++)
            // {
            //     if (s[j] == '#')
            //     {
            //         if (j < i)
            //             lb++;
            //         else
            //             rb++;
            //     }
            // }
            const int lb = ss[i - 1] - ss[0];
            const int rb = ss[n] - ss[i];

            const int ln = i, rn = n - i;
            const int lw = ln - lb, rw = rn - rb;
            const int ww = lb + rb;
            const int wb = lb + rw;
            const int bb = lw + rw;
            ans.push_back(min(ww, wb, bb));
        }
    }

    if (ans.empty())
        cout << 0 << endl;
    else
        cout << *min_element(ans.begin(), ans.end());

    return 0;
}
