#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  if (n == 0) {
    cout << '0' << endl;
    return 0;
  }
  string s;
  cin >> s;
  s += '0';
  vector<int> data;
  int c = 0;
  if (s[0] == '#')
    c = 1;
  else
    c = -1;
  for (int i = 1; i < n + 1; i++) {
    if (s[i - 1] != s[i]) {
      data.push_back(c);
      c = 0;
    }
    if (s[i] == '#') c++;
    if (s[i] == '.') c--;
  }
  int x = data.size();
  vector<int> kuroruikei(x, 0);
  vector<int> shiro(x, 0);
  for (int i = 0; i < x; i++) {
    if (i != 0) kuroruikei[i] = kuroruikei[i - 1];
    if (data[i] > 0) kuroruikei[i] += data[i];
    if (i != 0) shiro[i] = shiro[i - 1];
    if (data[i] < 0) shiro[i] += abs(data[i]);
  }
  reverse(shiro.begin(), shiro.end());
  int ans = 200010;
  for (int i = x - 1; i > 0; i--) {
    int tmp = 0;
    tmp += kuroruikei[i] - shiro[i];
    ans = min(ans, tmp);
  }
  int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') c1++;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '.') c4++;
  }
  bool st = false;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') st = true;
    if (s[i] == '#' && st) c2++;
  }
  bool start = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') start = true;
    if (start) {
      if (s[i] == '.') c3++;
    }
  }
  cout << min({ans, c1, c2, c3, c4});
}
