#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);
    }
  }
  vector<pair<char, int> > original_record = record;
  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;
      if (it > record.begin()) {
        for (vector<pair<char, int> >::iterator it_front = it - 1;
             it_front >= record.begin(); --it_front) {
          if (it_front->first == it->first) {
            front += it_front->second;
          } else if (it_front->first != it->first && it_front->second > 0) {
            break;
          }
        }
      }
      int back = (it + 1)->second;
      if (front > back) {
        recolor += back;
        it->second += back;
        (it + 1)->second = 0;
      } else {
        recolor += front;
        (it + 1)->second += front;
        it->second = 0;
      }
    }
  }
  int recolor_re = 0;
  for (vector<pair<char, int> >::iterator it = original_record.end() - 1;
       it > original_record.begin(); --it) {
    if (it->first == '.' && (it - 1)->first == '#') {
      int front = (it - 1)->second;
      int back = it->second;
      if (it < original_record.end() - 1) {
        for (vector<pair<char, int> >::iterator it_back = it + 1;
             it_back < original_record.end(); ++it_back) {
          if (it_back->first == it->first) {
            back += it_back->second;
          } else if (it_back->first != it->first && it_back->second > 0) {
            break;
          }
        }
      }
      if (front > back) {
        recolor_re += back;
        (it - 1)->second += back;
        it->second = 0;
      } else {
        recolor_re += front;
        it->second += front;
        (it - 1)->second = 0;
      }
    }
  }
  if (recolor > recolor_re) {
    cout << recolor_re << endl;
  } else {
    cout << recolor << endl;
  }
  return 0;
}
