#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int N;
  cin >> N;
  string S;
  cin >> S;
  char prev = 'Z';
  int64_t ans = 0;
  int64_t sharp = 0;
  int64_t dot = 0;
  int i = 0;
  while (i < N) {
    char cur = S[i];
    if (cur == '#') {
      if (prev == '.') {
        ans += min(sharp, dot);
        sharp = 0;
      }
      sharp++;
      dot = 0;
    } else {
      if (prev == '#') {
        dot = 0;
      }
      dot++;
    }
    i++;
    prev = cur;
  }
  ans += min(sharp, dot);
  cout << ans << endl;
  return 0;
}
