#include <bits/stdc++.h>
int main() {
  int N;
  std::string S;
  std::cin >> N >> S;
  std::vector<int> v(N);
  bool color = false;
  int pos = 0;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '#') {
      if (color == false) {
        color = true;
        ++pos;
      }
      v[pos]++;
    } else {
      if (color == true) {
        color = false;
        ++pos;
      }
      v[pos]++;
    }
  }
  int TransNum = 0;
  for (int i = 2; i <= pos; i += 2) {
    if (v[i] < v[i - 1]) {
      TransNum += v[i];
    } else {
      TransNum += v[i - 1];
    }
  }
  std::cout << TransNum << std::endl;
  return (0);
}
