#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
int main() {
  ull N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> vec;
  char now = '.';
  int cnt = 0;
  for (size_t i = 0; i < N; i++) {
    if (S[i] == now) {
      cnt++;
    } else {
      vec.push_back(cnt);
      if (now == '.') {
        now = '#';
      } else {
        now = '.';
      }
      cnt = 1;
    }
  }
  if (cnt != 0) {
    vec.push_back(cnt);
  }
  if (vec.size() % 2 == 0) {
    vec.push_back(0);
  }
  const size_t vecN = vec.size();
  vector<ull> dotonlys;
  for (size_t i = 0; i < vecN; i += 2) {
    dotonlys.push_back(vec[i]);
  }
  vector<ull> sharponlys;
  for (size_t i = 1; i < vecN - 1; i += 2) {
    sharponlys.push_back(vec[i]);
  }
  vector<ull> sumsdot(dotonlys.size() + 1);
  vector<ull> sumssharp(sharponlys.size() + 1);
  for (size_t i = 0; i < dotonlys.size(); i++) {
    sumsdot[i + 1] = sumsdot[i] + dotonlys[i];
  }
  for (size_t i = 0; i < sharponlys.size(); i++) {
    sumssharp[i + 1] = sumssharp[i] + sharponlys[i];
  }
  const ull dotsum = sumsdot.back();
  const ull sharpsum = sumssharp.back();
  ull sumline = 3 * 100000;
  for (size_t i = 0; i < sumssharp.size(); i++) {
    const ull tempdot = dotsum - sumsdot[i];
    const ull tempsharp = sumssharp[i];
    sumline = min(tempdot + tempsharp, sumline);
  }
  cout << min({dotsum, sharpsum, sumline}) << endl;
  return 0;
}
