#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, black = 0, lastwhite, firstblack, bcount = 0, wcount = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++)
    if (s[i] == '#') black++;
  if (black == n || black == 0) {
    cout << 0 << endl;
    return 0;
  }
  firstblack = (int)s.find("#", 0);
  lastwhite = (int)s.rfind(".", n);
  for (int i = firstblack + 1; i < n; i++)
    if (s[i] == '.') wcount++;
  for (int i = 0; i < lastwhite; i++)
    if (s[i] == '#') bcount++;
  cout << min({wcount, bcount, black, n - black}) << endl;
  return 0;
}
