#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  string s;
  cin >> s;
  bool b = false;
  bool w = false;
  ll black = 0, white = 0;
  ll ans = 0;
  for (long long i = 0; i < (long long)(n); i++) {
    if (s[i] == '#') {
      b = true;
      black++;
    } else if (b && s[i] == '.') {
      w = true;
      white++;
    } else if (w && b && s[i] == '#') {
      ans += min(white, black);
      w = false;
      black = 1;
    }
  }
  cout << ans << endl;
}
