#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  map<char, char> mask;
  mask['.'] = '#';
  mask['#'] = '.';
  int x = 0, ans = 0;
  while (x != n) {
    if ((x == '.') or (x == n - 1) or (s[x + 1] == '#'))
      x++;
    else {
      int cnt = 0, y = x;
      char aim = '#';
      while (y != n and s[y] == aim) y++, aim = mask[aim];
      int l = 0, r = 0;
      for (int i = x - 1; i >= 0 and s[i] == '#'; l++, i--)
        ;
      for (int j = y; j < n and s[j] == '.'; r++, j++)
        ;
      ans += (y - x) / 2;
      if (l < r)
        ans += l, x++;
      else {
        ans += r;
        s[y - 1] = '#';
        x = y;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
