fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn get<T: std::str::FromStr + Clone>() -> T {
    let line = read_vec::<T>();
    line[0].clone()
}

fn to_vec(string: String) -> Vec<char> {
    let mut vec = Vec::<char>::new();
    for c in string.chars() {
        vec.push(c);
    }
    vec
}

fn main() {
    let n = get::<usize>();
    let _s = get::<String>();
    let s = to_vec(_s);

    let mut _black = 0;
    let mut blacks = Vec::<i32>::new();
    let mut _white = 0;
    let mut whites = Vec::<i32>::new();
    let mut count_up = false;

    for x in 0..n {
        let c = s[x];
        if c == '#' {
            // case black
            count_up = true;
            if _white > 0 {
                whites.push(_white);
                _white = 0;
            }
            _black += 1
        } else {
            // case white
            if _black > 0 {
                blacks.push(_black);
                _black = 0;
            }
            if count_up {
                _white += 1;
            }
        }
    }

    whites.push(_white);
    _white = 0;

    let black = blacks.iter().sum::<i32>();
    let white = whites.iter().sum::<i32>();

    println!("{}", std::cmp::min(black, white));
}
