import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()

    c = collections.Counter(S)

    for i in range(N):
        if S[i] == '.':
            c['.'] -= 1
        else:
            break

    for i in range(N - 1, -1, -1):
        if S[i] == '#':
            c['#'] -= 1
        else:
            break

    print(max(0, min(c['.'], c['#'])))



if __name__ == '__main__':
    main()

