#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using P = pair<ll, ll>;
using ld = long double;
int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  char key = '.';
  vector<ll> cnt;
  ll now = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == key)
      now++;
    else {
      if (key == '.')
        key = '#';
      else
        key = '.';
      cnt.push_back(now);
      now = 1;
    }
  }
  cnt.push_back(now);
  if (cnt.size() % 2 == 1) {
    cnt.push_back(0);
  }
  vector<ll> black(cnt.size(), 0);
  vector<ll> white(cnt.size(), 0);
  for (int i = 0; i < cnt.size(); i++) {
    if (i % 2 == 1) {
      black[i] = black[i - 1] + cnt[i];
    } else {
      if (i != 0) {
        black[i] = black[i - 1];
      }
    }
  }
  reverse(cnt.begin(), cnt.end());
  for (int i = 0; i < cnt.size(); i++) {
    if (i % 2 == 1) {
      white[i] = white[i - 1] + cnt[i];
    } else {
      if (i != 0) {
        white[i] = white[i - 1];
      }
    }
  }
  reverse(white.begin(), white.end());
  ll ans = INF;
  for (int i = 0; i < n; ++i) {
    ans = min(black[i] + white[i], ans);
  }
  cout << ans << endl;
  return 0;
}
