#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
struct block_t {
  int beg, end;
  char ch;
};
int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int numofBlack = 0;
  int numofWhite = 0;
  int beg = 0;
  char prev = S.front();
  vector<block_t> block;
  block.push_back({0, 0, (S.front() == '.') ? '#' : '.'});
  for (int i = 0; i < N; i++) {
    if (S[i] != prev) {
      block.push_back({beg, i, prev});
      beg = i;
    }
    if (i == N - 1) {
      block.push_back({i, i + 1, S[i]});
    }
    prev = S[i];
  }
  block.push_back({N, N, (S.back() == '.') ? '#' : '.'});
  for (const auto& b : block) {
    if (b.ch == '#')
      numofBlack += b.end - b.beg;
    else
      numofWhite += b.end - b.beg;
  }
  int leftBlackCnt = 0;
  int rightWhiteCnt = numofWhite;
  int min = N;
  for (auto it = block.cbegin(); it != block.cend(); it++) {
    if (it->ch == '.') {
      rightWhiteCnt -= it->end - it->beg;
    } else {
      leftBlackCnt += it->end - it->beg;
    }
    int sum = rightWhiteCnt + leftBlackCnt;
    if (sum < min) min = sum;
  }
  cout << min;
  return 0;
}
