#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int result = 0;
  bool black = false;
  for (int i = 0; i < n; i++) {
    if (black && s.at(i) == '.') {
      result++;
    }
    if (!black && s.at(i) == '#') {
      if ((i + 1) < n) {
        if (s.at(i + 1) == '.') {
          result++;
          continue;
        }
        int j = i + 1;
        while (j < n && s.at(j) == '#') {
          j++;
        }
        int blackEnd = j - 1;
        int blackCount = j - i;
        while (j < n && s.at(j) == '.') {
          j++;
        }
        int whiteCount = j - blackEnd;
        if (blackCount < whiteCount) {
          i = blackEnd + 1;
          result += blackCount;
          continue;
        }
      }
      if ((i + 1) < n && s.at(i + 1) == '.') {
        result++;
        continue;
      }
      black = true;
    }
  }
  cout << result << endl;
  return 0;
}
