#include <bits/stdc++.h>
using namespace std;
int fx[4] = {1, -1, 0, 0};
int fy[4] = {0, 0, 1, -1};
int n, m;
const int mod = 998244353;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int c = INT_MAX, ans = 0;
  int w = 0, b = 0;
  int first = c;
  for (int i = n - 1; i >= 0;) {
    if (s[i] == '.' && i >= 0) {
      w++;
      i--;
    } else {
      c = w;
      while (s[i] == '#' && i >= 0) {
        b++;
        i--;
      }
      if (!w) {
        b = 0;
        w = 0;
        continue;
      }
      first = min(b, c);
      ans += first;
      b = 0;
      w = 0;
    }
  }
  cout << ans << endl;
}
