#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char s[500000];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  int pos;
  for (int i = 0; i < n; i++) {
    if (s[i] != '.') {
      pos = i;
      break;
    }
  }
  int posb;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] != '#') {
      posb = i;
      break;
    }
  }
  int cnt = 0;
  int cnt2 = 0;
  for (int i = pos; i <= posb; i++) {
    if (s[i] == '.') {
      cnt++;
    } else {
      cnt2++;
    }
  }
  int tmp = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      s[i] = '.';
      tmp++;
    } else {
      break;
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] != '.') {
      pos = i;
      break;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] != '#') {
      posb = i;
      break;
    }
  }
  int cnt3 = 0;
  int cnt4 = 0;
  for (int i = pos; i <= posb; i++) {
    if (s[i] == '.') {
      cnt3++;
    } else {
      cnt4++;
    }
  }
  cout << min(min(cnt, cnt2), min(cnt3 + tmp, cnt4 + tmp));
  return 0;
}
