#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  int n;
  string s;
  cin >> n >> s;
  long long bnum = 0, wnum = 0, b = 0;
  int c = n - 1;
  while (s[c] == '#') {
    c--;
    b++;
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    if (s[i] == '.') wnum++;
  }
  long long wn = 0;
  for (int(i) = 0; (i) < (n - b); (i)++) {
    if (s[i] == '#')
      bnum++;
    else
      wn++;
  }
  cout << min(bnum, min(wnum, wn)) << endl;
  return 0;
}
