# -*- coding: utf-8 -*-
"""
AtCoder C
"""
 
def main():
    N=input()
    S=list(map(str,input().split()))[0]
    tmp=False
    num=0
    for s in S:
        # print(s,tmp)
        if s=="#":
            tmp=True
        elif s=="." and tmp:
            num+=1

    num2=0
    bl=0
    for s in S:
        # print(s,tmp)
        if s=="#":
            num2+=1
            bl+=1
        else:
            bl=0

    print(min(num,num2-bl))
 
if __name__ == "__main__":
    main()