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

black_sum = [0]*(N+1)
white_sum = [0]*(N+1)
ans = 9999999999999999999
for i in range(N):
    key_black = 0
    key_white = 0
    if S[i]=='#':
        key_black = 1
    else:
        key_white = 1

    black_sum[i+1]=black_sum[i]+key_black
    white_sum[i+1]=white_sum[i]+key_white

for i in range(1,len(black_sum)):
    if black_sum[i] != black_sum[i-1]:
        left = black_sum[i] - 1 #境界左の黒石の数
        right = white_sum[N]-white_sum[i]  #境界右の白石の数
        tmp = left + right
        ans = min(tmp,ans)
if ans ==9999999999999999999:
    ans = 0
print(ans)