let N = Int(readLine()!)!
let S = readLine()!.characters
var cnt = S.reduce(0){$0+($1>"#" ?1:0)}
var ans = cnt
for c in S {
    let tmp = ans
    if c>"#" {
        cnt--
    } else {
        cnt++
    }
    ans = min(cnt, ans)
}
print(ans)