#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
int main() {
  int N;
  string set<int>;
  cin >> N >> set<int>;
  vector<int> bk;
  vector<int> wh;
  bool initialisbk = false;
  if (set<int>[0] == '#') {
    initialisbk = true;
  } else {
    initialisbk = false;
  }
  bool isbk = initialisbk;
  int temp = 0;
  for (int i = 0; i < (N); ++i) {
    if (isbk && set<int>[i] == '#') {
      temp++;
    } else if (isbk && set<int>[i] == '.') {
      bk.push_back(temp);
      temp = 1;
      isbk = false;
    } else if (!isbk && set<int>[i] == '#') {
      wh.push_back(temp);
      temp = 1;
      isbk = true;
    } else if (!isbk && set<int>[i] == '.') {
      temp++;
    }
  }
  if (set<int>[N - 1] == '#') {
    bk.push_back(temp);
  } else {
    wh.push_back(temp);
  }
  int ans = 0;
  if (initialisbk) {
    for (int i = 0; i < ((int)(bk).size()); ++i) {
      ans += min(bk[i], wh[i]);
    }
  } else {
    for (int i = 0; i < ((int)(wh).size() - 1); ++i) {
      ans += min(bk[i], wh[i + 1]);
    }
  }
  cout << ans << endl;
  return 0;
}
