def solve(s):
    found_black = False
    count_white = 0
    for c in s:
        if c == '#':
            found_black = True
        else:
            if found_black:
                count_white += 1
    found_white = False
    count_black = 0
    for c in reversed(s):
        if c == '.':
            found_white = True
        else:
            if found_white:
                count_black += 1
    
    s = s.lstrip('.')
    s = s.rstrip('#')
    answer = min(s.count('.'), s.count('#'))
    assert answer == min(count_white, count_black)
    return answer


def main():
    _ = int(input())
    s = input()
    print(solve(s))

if __name__ == "__main__":
    main()

import unittest
class Test(unittest.TestCase):
    def test1(self):
        self.assertEqual(solve('#.#'), 1)
    def test2(self):
        self.assertEqual(solve('#.##.'), 2)
    def test3(self):
        self.assertEqual(solve('.........'), 0)
    def test4(self):
        self.assertEqual(solve('#'), 0)
    def test5(self):
        self.assertEqual(solve('.'), 0)
    def test6(self):
        self.assertEqual(solve('#.'), 1)
    def test7(self):
        self.assertEqual(solve('##'), 0)
    def test8(self):
        self.assertEqual(solve('..'), 0)
    def test9(self):
        self.assertEqual(solve('.#'), 0)
    def test10(self):
        self.assertEqual(solve('#'*1000 + '.' * 999), 999)
    def test11(self):
        self.assertEqual(solve('#'*999 + '.' * 1000), 999)
