#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  char S[210012];
  scanf("%d %s", &N, S);
  int w = 0, b = 0;
  char bef = '@';
  vector<vector<char>> vv;
  vector<char> v;
  for (int i = 0; i < N; i++) {
    if (i > 0 && S[i] != bef) {
      vv.push_back(v);
      v = vector<char>();
    }
    v.push_back(S[i]);
    if (S[i] == '.')
      w++;
    else
      b++;
    bef = S[i];
  }
  if (v.size() > 0) vv.push_back(v);
  int l = vv.size();
  if (l == 1 || (l == 2 && S[0] == '.')) {
    printf("%d\n", 0);
  } else if (l == 2 && S[0] == '#') {
    printf("%d\n", min(w, b));
  } else {
    int sf = vv.front().size(), sb = vv.back().size();
    if (S[0] == '#' && S[N - 1] == '#') printf("%d\n", min(w, b - sf));
    if (S[0] == '.' && S[N - 1] == '#') printf("%d\n", min(w - sf, b - sb));
    if (S[0] == '#' && S[N - 1] == '.') printf("%d\n", min(w, b));
    if (S[0] == '.' && S[N - 1] == '.') printf("%d\n", min(w - sf, b));
  }
  return 0;
}
