#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int color;
  vector<int> vec;
  if (S.at(0) == '.') {
    color = 0;
  } else {
    color = 1;
  }
  int black = 0;
  int white = 0;
  for (int i = 1; i < N; i++) {
    if (S.at(i) != S.at(i - 1)) {
      vec.push_back(i);
    }
    if (S.at(i) == '#') {
      black++;
    }
    if (S.at(i) == '.') {
      white++;
    }
  }
  int minimum = N;
  if (vec.size() == 0) {
    minimum = 0;
  } else if (color == 0) {
    int i = 0;
    int sum = 0;
    for (int k = i + 2; k < vec.size(); k += 2) {
      sum += (vec.at(k) - vec.at(k - 1));
    }
    if (vec.size() % 2 == 0) {
      sum += (N - vec.at(vec.size() - 1));
    }
    minimum = min(minimum, sum);
    for (int j = 2; j < vec.size(); j += 2) {
      sum += (vec.at(j) - 2 * vec.at(j - 1) + vec.at(j - 2));
      minimum = min(minimum, sum);
    }
    cout << min({minimum, black, white}) << endl;
  } else if (color == 1) {
    int i = 1;
    int sum = 0;
    sum += vec.at(0);
    for (int k = i + 2; k < vec.size(); k += 2) {
      sum += (vec.at(k) - vec.at(k - 1));
    }
    if (vec.size() % 2 == 1) {
      sum += (N - vec.at(vec.size() - 1));
    }
    minimum = min(minimum, sum);
    for (int j = 2; j < vec.size(); j += 2) {
      sum += (vec.at(j) - 2 * vec.at(j - 1) + vec.at(j - 2));
      minimum = min(minimum, sum);
    }
    cout << min({minimum, black, white}) << endl;
  }
}
