import sys
from collections import Counter

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    S = input()
    D = Counter(S)

    cnt = 0
    for i in reversed(range(n)):
        if S[i] == "#":
            cnt += 1
        else:
            break

    print(min(D["#"] - cnt, D["."]))


if __name__ == '__main__':
    resolve()
