#include <bits/stdc++.h>
using namespace std;
long long solve(long long N, std::string S) {
  long long last_white = -1;
  long long first_black = -1;
  for (long long i = N - 1; i >= 0; --i) {
    if (S.at(i) == '.') {
      last_white = i;
      break;
    }
  }
  for (long long i = 0; i < N; ++i) {
    if (S.at(i) == '#') {
      first_black = i;
      break;
    }
  }
  if (last_white == -1 || first_black == -1 || last_white < first_black) {
    return 0;
  }
  long long N_short = last_white - first_black + 1;
  string new_string1 = S.substr(first_black, N_short);
  string new_string2 = S.substr(first_black, N_short);
  string new_string3 = S.substr(first_black, N_short);
  new_string1.at(N_short - 1) = '#';
  new_string2.at(0) = '.';
  new_string3.at(N_short - 1) = '#';
  new_string3.at(0) = '.';
  return min({solve(N_short, new_string1) + 1, solve(N_short, new_string2) + 1,
              solve(N_short, new_string3) + 2});
}
int main() {
  long long N;
  cin >> N;
  std::string S;
  std::cin >> S;
  cout << solve(N, S) << endl;
  return 0;
}
