#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string s;
  bool bo = false, ol = false;
  long long b = 0, w = 0;
  long long total = 0;
  cin >> n >> s;
  for (long long i = n - 1; i >= 0; i--) {
    if (bo) {
      if (s[i] == '.') {
        bo = false;
        if (b >= w) {
          total += w;
        } else {
          total += b;
        }
        w = 1;
        b = 0;
      } else {
        b++;
      }
    } else {
      if (s[i] == '#') {
        bo = true;
        b++;
      } else {
        w++;
      }
    }
  }
  if (bo) {
    if (b >= w) {
      total += w;
    } else {
      total += b;
    }
  }
  cout << total << endl;
  return 0;
}
