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

if len(set(S)) == 1:
    print(0)
    quit()



ans = 0

if S[0] == "#":
    i = 1
    while True:
        if S[i] == ".":
            ans = i
            S = S[i:]
            break
        else:
            i += 1
else:
    flag = False
    for i in S:
        if i == "#":
            flag = True
        if flag and i == ".":
            break
    else:
        print(0)
        quit()

if S[-1] == ".":
    i = 2
    while True:
        if S[-i] == "#":
            ans += (i-1)
            S = S[:-i+1]
            break
        else:
            i += 1


for i in range(len(S)):
    if S[i] == "#":
        S = S[i:]
        break
for i in range(1, len(S)+1):
    if S[-i] == ".":
        S = S[:-(i-1)]
        break


# odd = []
# even = []
# flag = False
# count = 1
# for i in range(1, len(S)):
#     if not S[i] == S[i-1]:
#         if not flag:
#             odd.append(count)
#         else:
#             even.append(count)
#         count = 1
#         flag = not flag
#     else:
#         count += 1
#
# if flag:
#     even.append(count)
# else:
#     odd.append(count)

# print(min(sum(odd), sum(even))+ans)

print(min(S.count("."), S.count("#")) + ans)
