from heapq import heappush,heappop


def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))


def runLength(in_str):
    kukan = 1
    start = 0
    ret = []
    for i in range(1,len(in_str)):
        if in_str[i-1]!=in_str[i]:
            ret.append([in_str[i-1],kukan,start])
            start = i
            kukan=0
        kukan+=1
    ret.append([in_str[-1],kukan,start])
    return ret

N = int_raw()
S= input()

dp = {}

def rec(ss):
    return 0

def main():
    global S
    ans =0
    numB = 0
    leftMostW = -1
    firstB = N
    for i in range(len(S)):
        if S[i]=="#":
            firstB = i
            break
    if firstB == N:
        return 0
    S = S[firstB:]

    for i in range(len(S)-1,-1,-1):
        if S[i]==".":
            leftMostW = i
            break
    if leftMostW ==-1:
        return 0
    leftsW = 0
    for i in range(leftMostW):
        if S[i] == "#":
            if leftsW ==0:
                leftsW = i
            numB+=1

    return min(numB,leftMostW+1-numB)



print(main())

