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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index) {
    vector.erase(vector.begin() + index);
}

template<class T>
T ma(vector<T> &v) {
    T maxi = 0;
    for (auto &i:v) maxi = max(maxi, i);
    return maxi;
}

#define rep(i, n, m) for (int i = n; i <= m; i++)
#define Rep(i, n, m) for (int i = m; i >= 1; i--)

typedef long long ll;
typedef unsigned long long ull;

long long ans = 0;

int main() {
    ull n;
    cin >> n;
    string s;
    cin >> s;
    bool bf = false;
    int black = 0;
    rep(i, n-1, 0) {
        if (s[i] == '#') {
            black++;
        } else {
            breal;
        }
    }
    int next = 0, b = 0, w = 0;
    rep(i, 0, n-black-1) {
        if (bf == false && s[i] == '.') {
            next++;
            continue;
        }

        if (s[i] == '#') {
            bf = true;
            b++;
        }
        else w++;
    }
    ans = n - black - next - min(b, w);
    cout << ans << endl;
}