#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int i = 0;
  while (i < N && S[i] == '.') {
    ++i;
  }
  ll ans = 0;
  while (i < N) {
    ll black_count = 0;
    while (i < N && S[i] == '#') {
      ++black_count;
      ++i;
    }
    if (i >= N) {
      break;
    }
    ll white_count = 0;
    while (i < N && S[i] == '.') {
      ++white_count;
      ++i;
    }
    ans += min(black_count, white_count);
  }
  cout << ans << endl;
  return 0;
}
