#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, ct1 = 0, ct2 = 0, ans = 0;
  string s;
  bool b1 = 1, b2 = 1;
  cin >> n >> s;
  vector<int> v1, v2;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '#')
      break;
    else {
      s.erase(0, 1);
      i--;
    }
  }
  reverse(s.begin(), s.end());
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '.')
      break;
    else {
      s.erase(0, 1);
      i--;
    }
  }
  reverse(s.begin(), s.end());
  if (s.length() > 0) {
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '#') {
        if (ct2 > 0) {
          v2.push_back(ct2);
          ct2 = 0;
        }
        ct1++;
      } else {
        if (ct1 > 0) {
          v1.push_back(ct1);
          ct1 = 0;
        }
        ct2++;
      }
    }
    v2.push_back(ct2);
    for (int i = 1; i < v1.size(); i++) {
      v1[i] += v1[i - 1];
      v2[i] += v2[i - 1];
    }
    ans = min(v1[v1.size() - 1], v2[v2.size() - 1]);
    for (int i = 0; i < v1.size() - 1; i++) {
      ans = min(ans, v2[v2.size()] - v2[i] + v1[i]);
    }
  } else
    ans = 0;
  cout << ans << "\n";
}
