#include <bits/stdc++.h>
using namespace std;
signed _main();
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
using v = vector<T>;
template <class T>
using vv = vector<v<T>>;
const long long MOD = 1e9 + 7;
const long long INF = 1LL << 60;
signed _main() {
  long long N, ans = 0;
  cin >> N;
  string S;
  cin >> S;
  long long cnt1 = 0, cnt2 = 0;
  for (long long i = 0; i < (N); ++i) {
    if (S[i] == '#') {
      if (cnt2 == 0) {
        cnt1++;
      } else {
        ans += min({cnt1, cnt2});
        cnt1 = 0, cnt2 = 0;
        cnt1++;
      }
    }
    if (S[i] == '.') {
      cnt2++;
    }
  }
  cout << ans << endl;
  return 0;
}
