#include <bits/stdc++.h>
using namespace std;
int b[200005], w[200005];
int main(void) {
  int n;
  string s;
  cin >> n >> s;
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  if (n == 2) {
    if (s[0] == '#' && s[1] == '.')
      cout << 1 << endl;
    else
      cout << 0 << endl;
    return 0;
  }
  if (s[0] == '.')
    w[0]++;
  else
    b[0]++;
  for (int i = 1; i <= n - 1; i++) {
    if (s[i] == '#')
      b[i]++;
    else
      w[i]++;
    b[i] += b[i - 1];
    w[i] += w[i - 1];
  }
  int f = 0, l = n - 1;
  while (s[f] == '.') f++;
  while (s[l] == '#') l--;
  f = min(f, n - 1);
  l = max(0, l);
  cout << min(w[l] - w[f], b[l] - b[f] + 1) << endl;
  return 0;
}
