#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  string s;
  s.reserve(N);
  cin >> s;
  int counter = 0;
  pii black, white;
  int i = 0;
  while (i < N) {
    if (s[i] == '.') {
      ++i;
      continue;
    }
    black.first = i;
    while (s[i] == '#' && i < N) {
      ++i;
    }
    black.second = i;
    white.first = i;
    while (s[i] == '.' && i < N) {
      ++i;
    }
    white.second = i;
    counter +=
        ((i > N) ? 0
                 : min(black.second - black.first, white.second - white.first));
  }
  cout << counter << "\n" << flush;
}
