N = int(input())
S = input()

score1 = 0
score2 = 0
length = 1
check = S[0]
A = []
flag = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        length += 1
    else:
        A.append(length)
        length = 1

if length != 1:
    A.append(length)

if len(A) != 0:
    if S[-1] != S[-2]:
        A.append(1)

if len(A) == 0:
    A.append(0)

if S[0] == ".":
    A.pop(0)
    flag = 1

if S[len(S)-1] == "#":
    A.pop(-1)
    flag = 1


for i in range(len(A)):
    if i % 2 == 0:
        score1 += A[i]
    else:
        score2 += A[i]

ans = min(score1,score2)

if flag == 0:
    ans = min(ans, A[0] + A[-1])

print(ans)