#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  long long n;
  string s;
  cin >> n;
  cin >> s;
  long long ans = 0;
  long long cnt = 0;
  long long white = 0;
  long long black = 0;
  bool flag = false;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '.' && !black)
      continue;
    else if (s[i] == '#' && !black) {
      black++;
    } else if (s[i] == '.' && black) {
      white++;
      flag = true;
    } else if (s[i] == '#' && black) {
      if (!flag) continue;
      if (black <= white) {
        ans += black;
        white = 0;
        black = 1;
        flag = false;
      } else if (black > white) {
        ans += white;
        black += white;
        black++;
      }
    }
  }
  ans += min(white, black);
  cout << ans << endl;
  ;
}
