# https://tenka1-2019-beginner.contest.atcoder.jp/tasks/tenka1_2019_c

import itertools
from collections import Counter
import bisect

def main():
    N = int(input())
    S = list(input())
    # print(S)

    if S.count('.') == N or S.count('#') == N:
        print(0)
        exit()

    first = -1
    for i in range(len(S)):
        if S[i] != '.':
            first = i
            break

    # print(S[first:])
    next_s = list(reversed(S[first:]))
    # print(next_s)
    last = -1
    for i in range(len(next_s)):
        if next_s[i] != '#':
            last = i
            break
    if last == -1: # all black
        print(0)
        exit()

    next_s = list(reversed(next_s[last:]))
    # print(next_s)
    # exit()
    next_s += '#'
    ans = 0
    black_count = 0
    white_count = 0
    for v in next_s:
        if v == '#':
            if white_count > 0:
                if white_count >= black_count:
                    ans += black_count
                else:
                    ans += white_count
                black_count = 0
                white_count = 0
            black_count += 1
        else:
            white_count += 1

    print(ans)
    # 全部黒か全部白
    # print(min(next_s.count('.'), next_s.count('#')))

if __name__ == '__main__':
    main()
