#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int offset = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '.')
      offset++;
    else
      break;
  }
  int roffset = 0;
  for (int i = n; i > 0; i--) {
    if (s[i] == '#')
      roffset++;
    else
      break;
  }
  int cnt = 0;
  vector<int> counts;
  bool flag = false;
  if (offset >= n - roffset)
    cout << 0 << endl;
  else {
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '#') {
        if (!flag)
          cnt++;
        else {
          flag = false;
          counts.push_back(cnt);
        }
      } else {
        if (flag)
          cnt++;
        else {
          flag = true;
          counts.push_back(cnt);
        }
      }
    }
    if (s[n - 1] == '#') {
      if (!flag)
        counts.push_back(cnt + 1);
      else {
        counts.push_back(cnt);
        counts.push_back(1);
      }
    }
    if (s[n - 1] == '.') {
      if (flag)
        counts.push_back(cnt + 1);
      else {
        counts.push_back(cnt);
        counts.push_back(1);
      }
    }
    int dt = 0;
    for (int i = 0; i < counts.size(); i++) {
      if (i % 2 == 1) dt += counts[i];
    }
    int sh = 0;
    int cnt = 0;
    vector<int> sharp, dot;
    int poscnt = 0, negcnt = 0;
    for (int i = 0; i < counts.size(); i++) {
      if (i % 2 == 0) {
        poscnt += counts[i];
        sharp.push_back(poscnt);
      } else {
        negcnt += counts[i];
        dot.push_back(negcnt);
      }
    }
    vector<int> diff;
    for (int i = 0; i < sharp.size(); i++) {
      diff.push_back(dt + sh);
      sh += sharp[i];
      dt -= dot[i];
    }
    int mini = INT_MAX;
    for (int i = 0; i < diff.size(); i++) mini = min(mini, diff[i]);
    cout << mini << endl;
  }
  return 0;
}
