#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, k;
  cin >> n;
  string s;
  cin >> s;
  int cntb = 0, cntw = 0, flag = 1, ans = 0;
  for (int y = 0; y < n; y++) {
    if (s[y] == '.')
      continue;
    else {
      cntb = 1;
      y++;
      while (s[y] == '#' && y < n) {
        y++;
        cntb++;
      }
      while (s[y] == '.' && y < n) {
        y++;
        cntw++;
      }
      if (cntb <= cntw) {
        ans += cntb;
        y--;
      } else {
        int tempb = 0, tempw = 0;
        while (y < n) {
          if (s[y] == '.')
            tempw++;
          else
            tempb++;
          y++;
        }
        if (tempw > tempb)
          ans += tempb + cntb;
        else
          ans += tempw + cntw;
      }
    }
    cntw = 0, cntb = 0;
  }
  cout << ans << "\n";
  return 0;
}
