#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<char, int> > record;
  getchar();
  char cur_c = 'a';
  pair<char, int> cur_pair;
  bool first_time = true;
  for (int i = 0; i < n; ++i) {
    char temp = getchar();
    if (temp == cur_c) {
      cur_pair.second += 1;
    } else {
      if (first_time) {
        first_time = false;
      } else {
        record.push_back(cur_pair);
      }
      cur_c = temp;
      cur_pair = make_pair(temp, 1);
    }
    if (i == n - 1) {
      record.push_back(cur_pair);
    }
  }
  int recolor = 0;
  for (vector<pair<char, int> >::iterator it = record.begin();
       it != record.end() - 1; ++it) {
    if (it->first == '#' && (it + 1)->first == '.') {
      int front = it->second;
      int back = (it + 1)->second;
      if (front > back) {
        recolor += back;
      } else {
        recolor += front;
      }
    }
  }
  cout << recolor << endl;
  return 0;
}
