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

void main() {
    const N = readln.chomp.to!long;
    const S = readln.chomp;

    auto whiteCount = new long[N+1];
    auto blackCount = new long[N+1];

    foreach (i; 0..N) {
        whiteCount[i+1] = S[i] == '.' ? 1 : 0;
        blackCount[i+1] = S[i] == '#' ? 1 : 0;
    }
    foreach (i; 0..N) {
        whiteCount[i+1] += whiteCount[i];
        blackCount[i+1] += blackCount[i];
    }

    // 0..i番目までが全部白、i..n番目までが全部黒にする
    iota(N+1).map!(i => blackCount[i] + whiteCount[N] - whiteCount[i]).reduce!min.writeln;
}

