#include <bits/stdc++.h>
using namespace std;
template <class T>
bool INRANGE(T x, T a, T b) {
  return a <= x && x <= b;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  string S;
  cin >> N >> S;
  long long white, black;
  long long ans = 0;
  bool first_white = true;
  for (int i = 0; i < (S.length() - 1); ++i) {
    if (S[i] == '.' and first_white)
      continue;
    else {
      first_white = false;
      if (S[i] == '#' and S[i + 1] == '.') {
        white = 1;
        black = 1;
        long long it = i;
        while (true) {
          if (S[it - 1] == '#' and it > 0) {
            black++;
            it--;
          } else
            break;
        }
        it = i;
        while (true) {
          if (S[it] == '.' and it < S.length()) {
            white++;
            it++;
          } else
            break;
        }
        ans += min(white, black);
        i = it;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
