#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 28);
int n;
string s;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> s;
  s = s.c_str();
  int bl = 0;
  int bl1[n];
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      bl++;
    }
    bl1[i] = bl;
  }
  int j = 0;
  int st = 0;
  int k = 0;
  int e = INF;
  while (j < n - 1) {
    if (s[j] == '#' && s[j + 1] != '#') {
      st = j;
      if (e == INF) e = j;
      break;
    }
    if (s[j] == '#' && s[j + 1] == '#') {
      k++;
      if (e == INF) e = j;
    }
    j++;
  }
  int m = min(bl, n - st - bl + k);
  if (j == n - 1) m = 0;
  if (bl == n) m = 0;
  if (bl == 0) m = 0;
  int t = INF;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '.') {
      t = i;
      break;
    }
  }
  m = min(m, bl - n + 1 + t);
  int count = 0;
  if (e == INF) e = 0;
  if (t == INF) t = n - 1;
  for (int i = e; i <= t; i++) {
    if (s[i] == '#') {
      count++;
    }
  }
  m = min(m, count);
  m = min(m, n - bl);
  cout << m << "\n";
}
