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

int main()
{
    int N;
    string S;
    cin >> N >> S;

    int first = -1;
    int last = N;
    int cnt1 = 0;
    int cnt2 = 0;

    for (int i = N - 1; 0 <= i; i--)
    {
        if (S.at(i) == '.')
        {
            last = i;
            break;
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == '#')
        {
            first = i;
            break;
        }
    }

    int cnt3 = 0;
    int cnt4 = 0;
    for (int i = 0; i < N; i++)
    {
        if (S.at(i) == '.')
        {
            cnt3++;
        }
        else
        {
            cnt4++;
        }

        if (last < N && i <= last)
        {
            if (S.at(i) == '#')
                cnt1++;
        }

        if (first >= 0 && first <= i)
        {
            if (S.at(i) == '.')
                cnt2++;
        }
    }

    int ans = min(min(cnt3, cnt4), max(cnt1, cnt2));

    cout << ans << endl;
}
