#include <bits/stdc++.h>
using namespace std;
inline int_fast64_t read() {
  int_fast64_t x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
inline string read_s() {
  string s = "";
  char c = getchar();
  while (c < '!' || c > '~') {
    c = getchar();
  }
  while (c >= '!' && c <= '~') {
    s += c;
    c = getchar();
  }
  return s;
}
void Main() {
  int N = read(), ans = 0, dot = 0, number = 0;
  string S = read_s();
  vector<int> ANS(1, 0);
  for (int i = 0; i < N; i++) {
    if (S[i] == '#' && dot != 0) {
      for (auto &Ans : ANS) Ans += dot;
      ans += number;
      ANS.push_back(ans);
      dot = number = 0;
    }
    if (dot == 0 && S[i] == '#') number++;
    if (number != 0 && S[i] == '.') dot++;
  }
  if (dot != 0) {
    for (auto &Ans : ANS) Ans += dot;
    ans += number;
    ANS.push_back(ans);
    dot = number = 0;
  }
  ans = *std::min_element(ANS.begin(), ANS.end());
  printf("%d\n", ans);
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Main();
  return 0;
}
