#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  for (int i = n - 1; i >= 0; i--) {
    if (s.at(i) == '#') {
      n--;
    } else {
      break;
    }
  }
  int blackCount = 0;
  int whiteCount = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == '.') {
      whiteCount++;
    } else {
      blackCount++;
    }
  }
  int result = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == '.') {
      whiteCount--;
      continue;
    }
    if (blackCount < whiteCount) {
      result++;
      blackCount--;
      continue;
    }
    result += whiteCount;
    break;
  }
  cout << result << endl;
  return 0;
}
