import sys

import collections



sys.setrecursionlimit(10 ** 8)



input = sys.stdin.readline





def main():

    N = int(eval(input()))

    S = input().strip()



    c = collections.Counter(S)

    c2 = collections.Counter()

    ans = min(c['.'], c['#'])



    for i in range(N):

        c2[S[i]] += 1

        ans = min(ans, c2['#'] + c['.'] - c2['.'])



    print(ans)





if __name__ == '__main__':

    main()

N = int(eval(input()))

S = input().strip()



bcnt = S.count("#")

wcnt = N - bcnt



ans = wcnt

cntb = 0

cntw = 0

for i in range(N):

    if S[i] == "#":

        cntb += 1

    else:

        cntw += 1



    ans = min(ans, cntb + wcnt - cntw)





print(ans)



import sys
import collections

sys.setrecursionlimit(10**8)
input = sys.stdin.readline


def main():
    N = int(eval(input()))
    S = input().strip()
    c = collections.Counter(S)
    c2 = collections.Counter()
    ans = min(c["."], c["#"])
    for i in range(N):
        c2[S[i]] += 1
        ans = min(ans, c2["#"] + c["."] - c2["."])
    print(ans)


if __name__ == "__main__":
    main()

N = int(eval(input()))
S = input().strip()
bcnt = S.count("#")
wcnt = N - bcnt
ans = wcnt
cntb = 0
cntw = 0
for i in range(N):
    if S[i] == "#":
        cntb += 1
    else:
        cntw += 1
    ans = min(ans, cntb + wcnt - cntw)
print(ans)

-import sys -import collections - -sys.setrecursionlimit(10**8) -input = sys.stdin.readline - - -def main(): -    N = int(eval(input())) -    S = input().strip() -    c = collections.Counter(S) -    c2 = collections.Counter() -    ans = min(c["."], c["#"]) -    for i in range(N): -        c2[S[i]] += 1 -        ans = min(ans, c2["#"] + c["."] - c2["."]) -    print(ans) - - -if __name__ == "__main__": -    main() +N = int(eval(input())) +S = input().strip() +bcnt = S.count("#") +wcnt = N - bcnt +ans = wcnt +cntb = 0 +cntw = 0 +for i in range(N): +    if S[i] == "#": +        cntb += 1 +    else: +        cntw += 1 +    ans = min(ans, cntb + wcnt - cntw) +print(ans)