#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, ans = 0, sha = 0, pri = 0;
  string S;
  cin >> A >> S;
  string T = S;
  vector<int> P;
  if (S[A - 1] == '#') {
    S += '.';
  } else if (S[A - 1] == '.') {
    S += '#';
  }
  for (int i = 0; i + 1 < A + 1; i++) {
    if (S[i] == '#') {
      sha++;
      if (S[i + 1] == '.') {
        P.push_back(sha);
        sha = 0;
      }
    } else if (S[i] == '.') {
      pri++;
      if (S[i + 1] == '#') {
        P.push_back(pri);
        pri = 0;
      }
    }
  }
  if (P.size() % 2 == 1) {
    P.push_back(0);
  }
  for (int i = 0; i + 1 < P.size(); i += 2) {
    ans += min(P[i], P[i + 1]);
  }
  cout << ans << endl;
}
