#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  char s[N];
  for (int i = 0; i < N; i++) {
    cin >> s[i];
  }
  char black = '#';
  char white = '.';
  int bcounter = 0;
  int wcounter = 0;
  int Ecounter = 0;
  if (s[0] == black)
    bcounter = 1;
  else if (s[0] == white)
    wcounter = 1;
  for (int i = 1; i < N; i++) {
    if (s[i] == black) {
      if (wcounter > 0) {
        Ecounter += (bcounter > wcounter) ? wcounter : bcounter;
        bcounter = 0;
        wcounter = 0;
      }
      bcounter++;
    } else {
      wcounter++;
      if (i == N - 1) {
        Ecounter += (bcounter > wcounter) ? wcounter : bcounter;
        break;
      }
    }
  }
  cout << Ecounter << endl;
  return 0;
}
