#include <bits/stdc++.h>
using namespace std;
double euclid_distance(double a, double b) { return sqrt(a * a + b * b); }
int gcd(long long int a, long long int b) {
  long long int r;
  if (a < b) {
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
  }
  while (r != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return r;
}
void Integer_factorization(long long int b, long long int n) {
  long long int a = 2;
  long long int count = 0;
  long long int ans = 1;
  long long int ndash = n;
  if (b == 1)
    cout << n << endl;
  else {
    while (ndash >= a * a) {
      if (n % a == 0) {
        count++;
        n /= a;
        if (count % b == 0) {
          ans *= a;
        }
      } else {
        a++;
        count = 0;
      }
    }
    cout << ans << endl;
  }
}
void ys() { cout << "Yes" << endl; }
void yb() { cout << "YES" << endl; }
void ns() { cout << "No" << endl; }
void nb() { cout << "NO" << endl; }
void solve(void) {
  int n;
  string s;
  cin >> n >> s;
  bool bflag = false, wflag = false;
  int bnum = 0, wnum = 0;
  int ans = 0;
  int p = 0;
  for (int(i) = (0); (i) < (n); (i)++) {
    if (s[i] == '.' && i == p) {
      p++;
    } else
      break;
  }
  for (int(i) = (p); (i) < (n); (i)++) {
    if (bflag) {
      bnum++;
    }
    if (wflag) {
      wnum++;
    }
    if (s[i] == '#' && !bflag) {
      ans += min(bnum, wnum);
      bnum = 0;
      bflag = true;
      wflag = false;
    }
    if ((s[i] == '.' && !wflag) || (s[i] == '.' && i == n - 1)) {
      if (i == n - 1) ans += min(bnum, wnum + 1);
      wnum = 0;
      bflag = false;
      wflag = true;
    }
  }
  cout << ans << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
