use proconio::{input, marker::Chars};

fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut count_white = vec![];
    let mut count_black = vec![];
    for &c in s.iter() {
        let a = if c == '#' { 1 } else { 0 };
        if let Some(&last) = count_black.last() {
            count_black.push(last + a);
        } else {
            count_black.push(a);
        }
    }
    for &c in s.iter() {
        let a = if c == '.' { 1 } else { 0 };
        if let Some(&last) = count_white.last() {
            count_white.push(last + a);
        } else {
            count_white.push(a);
        }
    }
    count_white.reverse();

    let mut ans = n;
    for i in 0..=n {
        let mut temp = 0;
        if i > 0 {
            temp += count_black[i - 1];
        }
        if i < n {
            temp += count_white[i];
        }

        ans = std::cmp::min(ans, temp);
    }

    println!("{}", ans);
}
