#!/snap/bin/pypy3

def sharpcounter(string):
    for i, char in enumerate(string):
        if char != '#':
            return i
    else:
        return len(string)


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

    count = 0
    tmp_sharp = 0
    for i, char in enumerate(S):
        if char == '#':
            tmp_sharp += 1
        else:
            if i + 1 < N and S[i+1] == '#':
                count += 1
                tmp_sharp += 1
            elif i + 1 == N:
                count += int(tmp_sharp > 0)
            else:
                count += min(tmp_sharp, sharpcounter(S[i+1:]))
                tmp_sharp = 0 

    print(count)

if __name__ == '__main__':
    main()
