# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    N = int(lines.pop(0))
    S = lines.pop(0)
    # reverse
    S = S[::-1]
    # 白が現れるまで省く
    idx = S.find('.')
    S = S[idx:]

    res = 0
    while(True):
        w = S.find('#')
        b = S[w:].find('.')

        if w < 0:
            break

        if ( w < b ):
            res += w
            S = S[w+b:]
        else:
            res += min(S.count('.'), S.count('#'))
            break

    print(res)
lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)