#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  bool ok = true;
  int cntb = 0, cntw = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == '#') ok = false;
    if (ok) continue;
    if (s.at(i) == '.')
      cntw++;
    else if (cntw == 0)
      cntb++;
    else {
      ans += min(cntb, cntw);
      cntb = 1, cntw = 0;
    }
  }
  ans += min(cntb, cntw);
  cout << ans << endl;
}
