#include <bits/stdc++.h>
int main() {
  int n;
  std::string s;
  std::cin >> n >> s;
  int black = 0;
  int white = 0;
  int first_black = 0;
  bool black_encounted = false;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      black++;
      if (!black_encounted) {
        first_black = i;
        black_encounted = true;
      }
    }
  }
  white = n - black;
  int consider_white = white - first_black;
  if (black == consider_white) {
    std::cout << black << std::endl;
    return 0;
  } else if (black == 0 || consider_white == 0) {
    std::cout << 0 << std::endl;
    return 0;
  }
  if (consider_white > black) {
    std::cout << black << std::endl;
  } else {
    std::cout << consider_white << std::endl;
  }
  return 0;
}
