#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cnt1[N], cnt2[N];
  for (int i = 0; i < N; ++i) {
    cnt1[i] = (S[i] == '#');
    if (i > 0) cnt1[i] += cnt1[i - 1];
  }
  for (int i = 0; i < N; ++i) {
    int c = 0;
    if (S[i] == '#') {
      int j = i + 1;
      while (j < N && S[j] != '#') {
        ++c;
        ++j;
      }
    }
    cnt2[i] = c;
  }
  int res = 0;
  for (int i = 0; i < N; ++i) {
    if (i + 1 < N && S[i] == '#' && S[i + 1] == '.') {
      res += min(cnt1[i], cnt2[i]);
    }
  }
  cout << res << "\n";
  return 0;
}
