# encoding:utf-8

import copy

import numpy as np

import random

import bisect #bisect_left　これで二部探索の大小検索が行える

import math



N = int(eval(input()))

S = str(eval(input()))



ans = 10**6

blacks = [0 for i in range(N)]

black = 0

white = 0

for i in range(N):

    if S[i] == "#":

        black += 1



    else:

        white += 1

    blacks[i] = black



ans = min(black,white,ans)



# print(blacks)

for i in range(1,N):

    cnt = 0

    cnt += (N-(i+1))-(blacks[N-1]-blacks[i])#white

    # print("white",cnt)

    cnt += blacks[i-1]#black

    # print(cnt)

    ans = min(ans,cnt)



print(ans)

# encoding:utf-8

import copy

import numpy as np

import random

import bisect #bisect_left　これで二部探索の大小検索が行える

import math



N = int(eval(input()))

S = str(eval(input()))



# ans = 10**6

# blacks = [0 for i in range(N)]

# black = 0

# white = 0

# for i in range(N):

#     if S[i] == "#":

#         black += 1

#

#     else:

#         white += 1

#     blacks[i] = black

#

# ans = min(black,white,ans)

#

# # print(blacks)

# for i in range(1,N):

#     cnt = 0

#     cnt += (N-(i+1))-(blacks[N-1]-blacks[i])#white

#     # print("white",cnt)

#     cnt += blacks[i-1]#black

#     # print(cnt)

#     ans = min(ans,cnt)

#

# print(ans)



#count white

cnt = S.count(".")



l = [cnt] #all black

for i in range(N):

    if S[i]==".":

        cnt -= 1

        l.append(cnt)

    else:

        cnt += 1

        l.append(cnt)



# print(l)

print((min(l)))

# encoding:utf-8
import copy
import numpy as np
import random
import bisect  # bisect_left　これで二部探索の大小検索が行える
import math

N = int(eval(input()))
S = str(eval(input()))
ans = 10**6
blacks = [0 for i in range(N)]
black = 0
white = 0
for i in range(N):
    if S[i] == "#":
        black += 1
    else:
        white += 1
    blacks[i] = black
ans = min(black, white, ans)
# print(blacks)
for i in range(1, N):
    cnt = 0
    cnt += (N - (i + 1)) - (blacks[N - 1] - blacks[i])  # white
    # print("white",cnt)
    cnt += blacks[i - 1]  # black
    # print(cnt)
    ans = min(ans, cnt)
print(ans)

# encoding:utf-8
import copy
import numpy as np
import random
import bisect  # bisect_left　これで二部探索の大小検索が行える
import math

N = int(eval(input()))
S = str(eval(input()))
# ans = 10**6
# blacks = [0 for i in range(N)]
# black = 0
# white = 0
# for i in range(N):
#     if S[i] == "#":
#         black += 1
#
#     else:
#         white += 1
#     blacks[i] = black
#
# ans = min(black,white,ans)
#
# # print(blacks)
# for i in range(1,N):
#     cnt = 0
#     cnt += (N-(i+1))-(blacks[N-1]-blacks[i])#white
#     # print("white",cnt)
#     cnt += blacks[i-1]#black
#     # print(cnt)
#     ans = min(ans,cnt)
#
# print(ans)
# count white
cnt = S.count(".")
l = [cnt]  # all black
for i in range(N):
    if S[i] == ".":
        cnt -= 1
        l.append(cnt)
    else:
        cnt += 1
        l.append(cnt)
# print(l)
print((min(l)))

-ans = 10**6 -blacks = [0 for i in range(N)] -black = 0 -white = 0 +# ans = 10**6 +# blacks = [0 for i in range(N)] +# black = 0 +# white = 0 +# for i in range(N): +#     if S[i] == "#": +#         black += 1 +# +#     else: +#         white += 1 +#     blacks[i] = black +# +# ans = min(black,white,ans) +# +# # print(blacks) +# for i in range(1,N): +#     cnt = 0 +#     cnt += (N-(i+1))-(blacks[N-1]-blacks[i])#white +#     # print("white",cnt) +#     cnt += blacks[i-1]#black +#     # print(cnt) +#     ans = min(ans,cnt) +# +# print(ans) +# count white +cnt = S.count(".") +l = [cnt]  # all black -    if S[i] == "#": -        black += 1 +    if S[i] == ".": +        cnt -= 1 +        l.append(cnt) -        white += 1 -    blacks[i] = black -ans = min(black, white, ans) -# print(blacks) -for i in range(1, N): -    cnt = 0 -    cnt += (N - (i + 1)) - (blacks[N - 1] - blacks[i])  # white -    # print("white",cnt) -    cnt += blacks[i - 1]  # black -    # print(cnt) -    ans = min(ans, cnt) -print(ans) +        cnt += 1 +        l.append(cnt) +# print(l) +print((min(l)))