#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n, ans = 0;
  string s;
  cin >> n >> s;
  int l = 0;
  while (s[l] == '.' && l < n) l++;
  int wc = 0, bc = 0;
  while (l < n) {
    while (s[l] == '#' && l < n) {
      l++;
      bc++;
    }
    while (s[l] == '.' && l < n) {
      l++;
      wc++;
    }
    if (bc <= wc) {
      ans += bc;
      bc = 0;
      wc = 0;
    } else {
      ans += wc;
      bc += wc;
      wc = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
