#include <bits/stdc++.h>
using namespace std;
const static unsigned long long INVALID_DIGIT = ~(unsigned long long)0;
int main() {
  unsigned long long N;
  string s;
  cin >> N;
  cin >> s;
  std::vector<unsigned long long> changeLeftCount(N, 0);
  std::vector<unsigned long long> changeRightCount(N, 0);
  auto isWhite = [](char c) { return c == '.'; };
  auto isBlack = [](char c) { return c == '#'; };
  for (unsigned long long i = 0; i < N; i++) {
    unsigned long long leftIdx = i;
    unsigned long long rightIdx = N - i - 1;
    bool leftIsBlack = isBlack(s[leftIdx]);
    bool rightIsWhite = isWhite(s[rightIdx]);
    unsigned long long changeLeft =
        leftIdx >= 1 ? changeLeftCount[leftIdx - 1] : 0;
    if (leftIsBlack) {
      changeLeft++;
    }
    changeLeftCount[leftIdx] = changeLeft;
    unsigned long long changeRight =
        rightIdx + 1 < N ? changeRightCount[rightIdx + 1] : 0;
    if (rightIsWhite) {
      changeRight++;
    }
    changeRightCount[rightIdx] = changeRight;
  }
  unsigned long long minReverseCount = N + 1;
  unsigned long long rightIdx = 1;
  for (unsigned long long i = 0; i + 1 < N; i++) {
    unsigned long long leftIdx = i;
    unsigned long long rightChange = 0;
    rightIdx = std::max(i + 1, rightIdx);
    while (rightIdx < N && isWhite(s[rightIdx])) {
      rightIdx++;
    }
    if (rightIdx < N) {
      rightChange = changeRightCount[rightIdx];
    }
    minReverseCount =
        std::min(changeLeftCount[leftIdx] + rightChange, minReverseCount);
  }
  if (minReverseCount == N + 1) {
    minReverseCount = 0;
  }
  cout << minReverseCount << endl;
  return 0;
}
