#!/usr/bin/env python3
#Tenka1 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n = int(input())
s = input()
d = [1 if s[i] == "#" else 0 for i in range(n)]
d = list(accumulate(d))
ans = 0
for i in range(n):
    if s[i] == '#':
        cnt1 = d[-1] - d[i]
        cnt2 = n - (i+1) - cnt1
        if cnt1 <= cnt2:
            ans += cnt2
            break
        else:
            ans += 1
print(ans)
