#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

long ans = 100000000000;
void fuga(long long num)
{
    if (num < ans) {
        ans = num;
    }
}

int main()
{
    int N;
    std::string S;
    int pre_is_sharp = -1;
    scanf("%d", &N);
    std::cin >> S;
    std::vector<int> r{0};

    for (int i = 0; i < N; i++) {
        if (S[i] == '#') {
            if (pre_is_sharp == 1) {
                r.push_back(i);
            }
            pre_is_sharp = 0;
        } else {

            if (pre_is_sharp == 0) {
                r.push_back(i);
            }
            pre_is_sharp = 1;
        }
    }
    long long size_r = size(r);
    if (S[0] == '#') {

        for (int i = 0; i < size_r / 2; i++) {
            long long hoge = 0;
            for (int j = 0; j < size_r / 2; j++) {
                if (j > i) {
                    hoge += r[2 * i + 2] - r[2 * i + 1];
                } else {
                    hoge += r[2 * i + 1] - r[2 * i];
                }
            }
            fuga(hoge);
        }
    } else {
        for (int i = 1; i < size_r / 2; i++) {
            long long hoge = 0;
            for (int j = 0; j < size_r / 2; j++) {
                if (j > i) {
                    hoge += r[2 * i + 1] - r[2 * i];
                } else {
                    hoge += r[2 * i] - r[2 * i - 2];
                }
            }
            fuga(hoge);
        }
    }

    printf("%d", ans);

    return 0;
}
