from collections import Counter

def colored(S):
    output = ""
    for i in range(len(S)):
        if S[i] == "#":
            output += "B"
        else:
            output += "W"
    return output

def rewrite(S):
    S = list(S)
    if len(set(S)) == 1:
        return 0
    else:
        #最終的には上書きした結果端以外はどちらかの色に統一される
        output_B = S[1:].count("W")
        output_W = S[:len(S)-1].count("B")
        return min(output_B,output_W)

def main():
    N = int(input())
    S = input()
    S = colored(S)
    ans = rewrite(S)
    print(ans)

if __name__ == "__main__":
    main()
