#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const long long mo = 1e10 + 7;
const int M = 100 + 50;
const long long mod = 998244353;
struct node {
  int col;
  int num;
};
node p[N];
int main() {
  int n;
  string s;
  cin >> n >> s;
  long long answ = 0, ansb = 0, ans = 0;
  int num = 1, mark = 0;
  int j = 0;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == s[i - 1])
      num++;
    else {
      if (s[i - 1] == '.') {
        p[j].col = 0;
        p[j].num = num;
        j++;
        num = 1;
      }
      if (s[i - 1] == '#') {
        p[j].col = 1;
        p[j].num = num;
        j++;
        num = 1;
      }
    }
    if (i == s.length() - 1) {
      if (s[i] == '.') {
        p[j].col = 0;
        p[j].num = num;
        j++;
      }
      if (s[i] == '#') {
        p[j].col = 1;
        p[j].num = num;
        j++;
      }
    }
  }
  for (int i = 0; i < j - 1; i++) {
    if (p[i].col == 1 && p[i + 1].col == 0) {
      ans = ans + min(p[i].num, p[i + 1].num);
    }
  }
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '.' && s[i - 1] == '#') {
      s[i] = '#';
      i--;
      answ++;
    }
  }
  for (int i = j - 1; i > 0; i--) {
    if (p[i].col == 0 && p[i - 1].col == 1) {
      ansb = ansb + p[i - 1].num;
    }
  }
  cout << min(ansb, min(ans, answ)) << "\n";
  return 0;
}
