#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N;
  cin >> S;
  int ans = 0;
  int flagb = 0;
  int flagw = 0;
  vector<int> b, w;
  for (typeof((S).begin()) i = (S).begin(); i != (S).end(); ++i) {
    if (*i == '#') {
      flagb++;
      if (flagw > 0) {
        w.push_back(flagw);
        flagw = 0;
      }
    }
    if (*i == '.') {
      flagw++;
      if (flagb > 0) {
        b.push_back(flagb);
        flagb = 0;
      }
    }
  }
  b.push_back(flagb);
  w.push_back(flagw);
  if (S[0] == '#') {
    auto j = w.begin();
    for (typeof((b).begin()) i = (b).begin(); i != (b).end(); ++i) {
      if (*i <= *j)
        ans += *i;
      else {
        ans += *j;
        *(i + 1) += *j + *i;
      }
      j++;
    }
  }
  if (S[0] == '.') {
    auto j = w.begin() + 1;
    for (typeof((b).begin()) i = (b).begin(); i != (b).end(); ++i) {
      if (*i <= *j)
        ans += *i;
      else {
        ans += *j;
        *(i + 1) += *j + *i;
      }
      j++;
    }
  }
  cout << ans << endl;
  return 0;
}
