n = int(input())
s = input()
s = list(s)

count = 0
white_count = 0
white_count2 = 0
black_count = 0
black_No = 0

for i in range(n):
    if s[i] == "#":
        black_No = i
        break

for i in range(n - black_No):
    if s[i + black_No] == ".":
        white_No = i + black_No
        break

while True:
    try:
        if s[white_No + count] == ".":
            count += 1
        else:
            break
    except:
        break

for i in range(n - black_No):
    if s[i + black_No] == ".":
        white_count += 1

if count > white_No - black_No:
    t = n - white_No - count
    for i in range(t):
        if s[i + white_No + count] == ".":
            white_count2 += 1
    for j in range(n - t):
        if s[j] == "#":
            black_count += 1
    result = black_count + white_count2
else:
    result = white_count

print(result)
