from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    N = makeInt(input_string[0])
    S = input_string[1].rstrip()
    if len(S) == 1:
        return 0
    if S == "#.":
        return 1
    S = list("."+S)
    w = "."
    b = "#"
    c = 0
    b_c = 0
    b_b_c = 0
    for i in range(N):
        if S[i] == b:
            b_c += 1
        else:
            if b_c != 0:
                b_b_c += b_c
            b_c = 0
        if S[i] == w and S[i-1] == b:
            if b_b_c < len(S) - i:
            #b_c = 0
                w_c = 0
                flag = False
                for j in range(i, N+1):
                    if S[j] == w:
                        w_c += 1
                        if w_c > b_b_c + b_c:
                            for h in range(0, i)[::-1]:
                                if S[h] == b:
                                    S[h] = w
                                    c += 1
                            flag = True
                if flag:
                    continue
                #for k in range(0, i)[::-1]:
                #    if S[k] == b:
                #         b_c += 1
                #    else:
                #        break

                #print(w_c)
                #print(b_c)
                if w_c <= b_b_c + b_c:
                    S[i] = b
                    c += 1
                    continue
        if S[i] == b:
            if S[i-1] == w and S[i+1] == w:
                S[i] = w
                c += 1
                continue
        if i > 0 and S[i] == w:
            #print(S)
            #print(S[i])
            if S[i-1] == b:
                S[i] = b
                c += 1
    i = N
    if i == N:
        #print("a")
        #print(S)
        #print(S[i])
        if S[i-1] == b and S[i] == w:
            S[i] = b
            c += 1
    return c


def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()
