#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
int main(int, char**) {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cntb = 0;
  int cntw = 0;
  if (s[0] == '.')
    cntw++;
  else
    cntb++;
  char prev = s[0];
  int ret = 0;
  bool flag = false;
  for (int i = 1; i < n; i++) {
    char now = s[i];
    if (prev == '.' && now == '.') {
      cntw++;
    } else if (prev == '#' && now == '#') {
      cntb++;
    } else if (prev == '#' && now == '.') {
      flag = true;
      cntw = 1;
    } else {
      if (flag) {
        ret += min(cntw, cntb);
        cntw = 0;
        cntb = 1;
        flag = false;
      } else {
        cntb++;
      }
    }
    if (i == n - 1 && flag) ret += min(cntw, cntb);
    prev = now;
  }
  cout << ret << endl;
  return 0;
}
