def main():
    n = int(input())
    s = list(input())
    
    arr = []
    cnt = 1
    for i in range(1, n):
        if s[i] == s[i - 1]:
            cnt += 1
        else:
            arr.append(cnt)
            cnt = 1
    arr.append(cnt)
    
    if s[0] == '.':
        arr = [0] + arr
    if s[-1] == '#':
        arr += [0]
    
    for i in range(len(arr) - 3, -1, -2):
        arr[i] += arr[i + 2]
    
    ans = 0
    for i in range(0, len(arr), 2):
        if arr[i] > arr[i + 1]:
            ans += arr[i + 1]
            break
        else:
            ans += arr[i]
    
    print(ans)
    return 0

main()