#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  std::cin >> n;
  std::cin >> s;
  int countFlag = 0;
  int count_b = 0;
  int count_w = 0;
  int val = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s.substr(i, 1) == "#") {
      switch (countFlag) {
        case 0:
          countFlag = 1;
          count_b = 1;
          break;
        case 1:
          ++count_b;
          break;
        case 2:
          int countFlag = 0;
          int count_b = 0;
          int count_w = 0;
          val += min(count_b, count_w);
          break;
      }
    } else {
      switch (countFlag) {
        case 0:
          break;
        case 1:
          countFlag = 2;
          count_w = 1;
          break;
        case 2:
          ++count_w;
          break;
      }
    }
  }
  val += min(count_b, count_w);
  cout << val << endl;
}
