#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  string S;
  cin >> N;
  cin >> S;
  char before = S[0];
  long long count = 0, countIndex = 0;
  vector<long long> countVector, blackIndexVector;
  for (int i = 0; i < N; i++) {
    if (S[i] == before) {
      count++;
    } else {
      if (before == '#') {
        blackIndexVector.push_back(countIndex);
        countVector.push_back(count);
      } else {
        countVector.push_back(-count);
      }
      count = 1;
      countIndex++;
    }
    before = S[i];
  }
  if (count == 0) {
    if (before == '#') {
      countVector.push_back(1);
    } else {
      countVector.push_back(-1);
    }
  } else {
    if (before == '#') {
      countVector.push_back(count);
    } else {
      countVector.push_back(-count);
    }
  }
  if (before == '#') {
    blackIndexVector.push_back(countIndex);
  }
  countIndex++;
  vector<long long> howManyFlip;
  for (long long i = 0; i < blackIndexVector.size(); i++) {
    long long blackIndex = blackIndexVector[i];
    long long blackToWhite = 0;
    long long whiteToBlack = 0;
    for (long long j = 0; j < blackIndex; j++) {
      if (countVector[j] > 0) {
        blackToWhite += countVector[j];
      }
    }
    for (long long j = blackIndex + 1; j < countVector.size(); j++) {
      if (countVector[j] < 0) {
        whiteToBlack += (-countVector[j]);
      }
    }
    howManyFlip.push_back(blackToWhite + whiteToBlack);
  }
  if (blackIndexVector.size() == 0) {
    cout << 0 << endl;
  } else {
    cout << *min_element(howManyFlip.begin(), howManyFlip.end()) << endl;
  }
  return 0;
}
