import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    S = SS()

    # #を.に変える個数は最右.から左の#の個数
    # .を#に変える個数は最左#から右の.の個数
    white = []
    black = []
    for i in range(N):
        if S[i] == '.':
            white.append(i)
        else:
            black.append(i)

    right_w = -1
    if white:
        right_w = white[-1]
    left_b = N
    if black:
        left_b = black[0]

    ans_w = bisect.bisect_left(black, right_w)
    ans_b = len(white) - bisect.bisect_left(white, left_b)

    print(min(ans_w, ans_b))

if __name__ == '__main__':
    resolve()
