import std.stdio, std.array, std.conv, std.string, std.range, std.algorithm;


void main() {
    long n = readln.strip.to!(long);
    string s = readln.strip;

    long l = 0, r = s.length - 1;
    while (l < s.length && s[l] == '.') {
        l++;
    }
    while (r >= 0 && s[r] == '#') {
        r--;
    }
    r++;

    long w = s[l..r].count('.');
    long b = s[l..r].count('#');

    long right = w;
    long left = 0;
    long m = left + right;
    foreach (i; l..r) {
        if (s[i] == '.') {
            right--;
        } else {
            left++;
        }
        m = min(m, left + right);
    }
    writeln(m);

}
