#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1000000000;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> btow, wtob;
  long long tmp = 0;
  for (int i = 0; i < n; ++i) {
    tmp += (s[i] == '#');
    while (s[i] == s[i + 1] && i + 1 < n) {
      i++;
      tmp += (s[i] == '#');
    }
    btow.push_back(tmp);
  }
  reverse(s.begin(), s.end());
  tmp = 0;
  for (int i = 0; i < n; ++i) {
    tmp += (s[i] == '.');
    while (s[i] == s[i + 1] && i + 1 < n) {
      i++;
      tmp += (s[i] == '.');
    }
    wtob.push_back(tmp);
  }
  reverse(wtob.begin(), wtob.end());
  reverse(s.begin(), s.end());
  int l = btow.size();
  long long ans = INF;
  if (l == 1)
    ans = 0;
  else if (l == 2) {
    tmp = 0;
    bool flag = (s[0] == '.');
    for (int i = 0; i < n; ++i) {
      if (s[i] == '#') flag = false;
      tmp += (!flag && s[i] == '.');
    }
    reverse(s.begin(), s.end());
    tmp = 0;
    flag = (s[0] == '#');
    for (int i = 0; i < n; ++i) {
      if (s[i] == '.') flag = false;
      tmp += (!flag && s[i] == '#');
    }
    ans = min(ans, tmp);
  } else {
    for (int i = 0; i < l - 2; ++i) {
      ans = min(ans, btow[i] + wtob[i + 2]);
    }
  }
  cout << ans << endl;
  return 0;
}
