#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> arr(2, 0);
  bool sharp = false;
  int arrsize = str.size();
  for (int i = str.size() - 1; i >= 0; i--) {
    if (str[i] == '#')
      arrsize--;
    else
      break;
  }
  for (int i = 0; i != arrsize; i++) {
    if (str[i] == '#') {
      arr[0]++;
      sharp = true;
    } else if (sharp == true)
      arr[1]++;
  }
  vector<int> temp(2, 0);
  for (int i = str.size() - 1; i >= 0; i--) {
    if (temp[0] != 0 && temp[1] != 0 && str[i] != str[i + 1]) break;
    if (str[i] == '#') {
      temp[0]++;
    } else {
      temp[1]++;
    }
  }
  if (temp[0] > temp[1]) arr[0] -= (temp[0] - temp[1]);
  cout << min(arr[0], arr[1]) << endl;
  return 0;
}
