N = int(input())
S = input()
min = N
# '#'の累積和
clm_sum = [0]
for s in S:
    if s == '#':
        clm_sum.append(clm_sum[-1] + 1)
    else:
        clm_sum.append(clm_sum[-1])
if S.find('#') == -1 or S.find('.') == -1:
    min = 0
for i in range(1,len(clm_sum)):
    if clm_sum[i] + (N - i - (clm_sum[-1] - clm_sum[i])) < min:
        min = clm_sum[i] + (N - i - (clm_sum[-1] - clm_sum[i]))
print(min)