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

counter = [[0,0] for i in range(N)]
count = 0
for i in range(N):
    if S[i] == '#':
        count += 1
    counter[i][0] = count

count = 0
for i in range(N)[::-1]:
    if S[i] == '.':
        count += 1
    counter[i][1] = count

mini = N
for i in range(N-1):
    if mini > counter[i][0] + counter[i+1][1]:
        #print(i, counter[i][0] + counter[i+1][1])
        mini = counter[i][0] + counter[i+1][1]

white = S.count('.')
print(mini if white != 0 and white != N else 0)
#print(counter)
