#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  string S;
  cin >> N >> S;
  ll toBlack = 0;
  ll temp = 0;
  for (int i = N - 1; i >= -1; --i) {
    toBlack += temp;
    temp = 0;
    while (i >= 0 && S[i] == '.') {
      --i;
      temp++;
    }
  }
  ll toWhite = 0;
  temp = 0;
  for (int i = 0; i <= N; i++) {
    toWhite += temp;
    temp = 0;
    while (i < N && S[i] == '#') {
      temp++;
      i++;
    }
  }
  cout << min(toBlack, toWhite) << endl;
  return 0;
}
