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

# 白にする
res1 = 0
index1 = 0
if s[-1] == ".":
    for i in range(len(s) - 1, -1, -1):
        if s[i] == "#":
            res1 += 1
else:
    for i in range(len(s) - 1, 0, -1):
        if s[i] != s[i - 1]:
            index1 = i - 1
            break
    for i in range(index1):
        if s[i] == "#":
            res1 += 1

# print(index1)


# 黒にする
res2 = 0
index2 = 0

if s[0] == "#":
    for i in range(1, len(s)):
        if s[i] == ".":
            res2 += 1
else:
     for i in range(1, len(s)):
         if s[i] != s[i - 1]:
             index2 = i
             res2 += 1
             break
     for i in range(index2 + 1, len(s)):
         if s[i] == ".":
             res2 += 1



# print(res1, res2)
print(min(res1, res2))