import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


if __name__ == '__main__':
    N = int(input())
    S = input()

    T = []
    res = []
    flag = False
    for s in S:
        if (s == '#') and (not flag):
            res.append('#')
        elif (s == '.') and (flag):
            res.append('.')
        elif (s == '#') and (flag):
            T.append(''.join(res))
            flag = False
            res = ['#']
        elif (s == '.') and (not flag):
            flag = True
            res.append('.')

    res = ''.join(res)
    if "#." in res:
        T.append(res)

    ans = 0
    for t in T:
        cnt_b = 0
        cnt_w = 0
        for t_ in t:
            if t_ == '#':
                cnt_b += 1
            else:
                cnt_w += 1
        ans += min(cnt_b, cnt_w)

    print(ans)
