inpl = lambda: list(map(int,input().split()))



def get_sequence(arr):

    if len(arr) == 0:

        return [], []

    elements = []

    nums = []

    n = 1

    prev = arr[0]

    for c in arr[1:]:

        if c == prev:

            n += 1

        else:

            elements.append(prev)

            nums.append(n)

            prev = c

            n = 1

    elements.append(prev)

    nums.append(n)

    return elements, nums



N = int(eval(input()))

S = eval(input())



ele, num = get_sequence(S)

B = S.count('#')

W = N - B



if ele[0] == '#':

    ans = W

    i = 1

else:

    ans = W - num[0]

    i = 2



M = len(num)

cur = ans

while i < M:

    cur += num[i-1]-num[i]

    ans = min(ans,cur)

    i += 2



print(ans)
inpl = lambda: list(map(int,input().split()))

N = int(eval(input()))

S = eval(input())



W = S.count('.')

cur = W

ans = cur

for i in range(N):

    if S[i] == '.':

        cur -= 1

        if cur < ans:

            ans = cur

    else:

        cur += 1

print(ans)
inpl = lambda: list(map(int, input().split()))


def get_sequence(arr):
    if len(arr) == 0:
        return [], []
    elements = []
    nums = []
    n = 1
    prev = arr[0]
    for c in arr[1:]:
        if c == prev:
            n += 1
        else:
            elements.append(prev)
            nums.append(n)
            prev = c
            n = 1
    elements.append(prev)
    nums.append(n)
    return elements, nums


N = int(eval(input()))
S = eval(input())
ele, num = get_sequence(S)
B = S.count("#")
W = N - B
if ele[0] == "#":
    ans = W
    i = 1
else:
    ans = W - num[0]
    i = 2
M = len(num)
cur = ans
while i < M:
    cur += num[i - 1] - num[i]
    ans = min(ans, cur)
    i += 2
print(ans)

inpl = lambda: list(map(int, input().split()))
N = int(eval(input()))
S = eval(input())
W = S.count(".")
cur = W
ans = cur
for i in range(N):
    if S[i] == ".":
        cur -= 1
        if cur < ans:
            ans = cur
    else:
        cur += 1
print(ans)

- - -def get_sequence(arr): -    if len(arr) == 0: -        return [], [] -    elements = [] -    nums = [] -    n = 1 -    prev = arr[0] -    for c in arr[1:]: -        if c == prev: -            n += 1 -        else: -            elements.append(prev) -            nums.append(n) -            prev = c -            n = 1 -    elements.append(prev) -    nums.append(n) -    return elements, nums - - -ele, num = get_sequence(S) -B = S.count("#") -W = N - B -if ele[0] == "#": -    ans = W -    i = 1 -else: -    ans = W - num[0] -    i = 2 -M = len(num) -cur = ans -while i < M: -    cur += num[i - 1] - num[i] -    ans = min(ans, cur) -    i += 2 +W = S.count(".") +cur = W +ans = cur +for i in range(N): +    if S[i] == ".": +        cur -= 1 +        if cur < ans: +            ans = cur +    else: +        cur += 1