import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(string s) {
    int[] ww = new int[s.length]; // [0, i] を全て白にするコスト
    int[] bb = new int[s.length]; // [i, $] を全て黒にするコスト
    int cost = 0;
    for (int i = 0; i < s.length; i++) {
        if (s[i] == '#') cost++;
        ww[i] = cost;
    }

    cost = 0;
    for (int i = cast(int)s.length-1; i >= 0; i--) {
        if (s[i] == '.') cost++;
        bb[i] = cost;
    }

    int ans = min(ww[$-1], bb[0]);
    for (int i = 0; i < s.length; i++) {
        // [0, i] を白、[i+1, $-1] を黒にするコスト
        int c = ww[i] + (i + 1 < s.length ? bb[i + 1] : 0);
        ans = min(ans, c);
    }
    return ans;
}

void main() {
    readint;
    string s = read!string;
    int ans = calc(s);
    writeln(ans);
}
