#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
using namespace std;
int main() {
  int n, count = 0;
  int custoPonto = 0, custoHash = 0;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '#' and s[i + 1] == '.') {
      int j = i + 1;
      custoPonto = 0;
      while (j < n and s[j] == '.') {
        custoPonto++;
        j++;
      }
      int k = i;
      custoHash = 0;
      while (k >= 0 and s[k] == '#') {
        custoHash++;
        k--;
      }
      if (custoHash > custoPonto) {
        int j = i + 1;
        count += custoPonto;
        while (custoPonto != 0) {
          s[j] = '#';
          j++;
          custoPonto--;
        }
      } else {
        int k = i;
        count += custoHash;
        while (custoHash != 0) {
          s[k] = '.';
          k--;
          custoHash--;
        }
      }
    }
  }
  cout << count << "\n";
}
