use std::iter::*;
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn print<T: std::fmt::Display>(x: T) -> () {
    println!("{}", x);
}


fn main() {
    let n: usize = read();
    let s: String = read();
    let cs: Vec<char> = s.chars().collect();
    let mut ms: Vec<usize> = vec![];;
    let mut ans = 0;

    let mut t = cs[0];
    let mut j: usize = 0;
    for i in 0..n {
        if cs[i] == t {
            j += 1;
            if i == n - 1 {
                ms.push(j);
            }
        } else {
            ms.push(j);
            j = 1;
            t = cs[i];
            if i == n - 1 {
                ms.push(j);
            }
        }
    }

    let len: usize = ms.len();
    for i in 0..len {
        if i % 2 == 1 {
            continue;
        }
        
        if len % 2 == 0 {
            ans += min(ms[i], ms[i + 1])
        } else if i == len - 1 && cs[len - 1] == '.' && len != 1 {
            ans += ms[i];
        }
    }
    print(ans);
}
