def inorderReplace(S , N): 
    S = list(S)
    cnt = 0
    for i in range(N - 1) : 
        nowChar = S[i]
        nextChar = S[i + 1]
        if nowChar == "#" and nextChar == "." : 
            cnt += 1
            S[i + 1] = "#"
    return cnt

def preorderReplace(S , N) : 
    S = list(S)
    cnt = 0
    for i in reversed(range(1, N)) : 
        nowChar = S[i]
        prevChar = S[i - 1]
        if prevChar == "#" and nowChar == "." : 
            cnt += 1
            S[i - 1] = "."
    return cnt


cnt = inorderReplace(S , N)
cnt2 = preorderReplace(S , N)
print(min(cnt , cnt2))