#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int rw[n], lb[n], lw[n];
  lb[0] = 0;
  lw[0] = 0;
  rw[n - 1] = 0;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] == '#') {
      lb[i] = lb[i - 1] + 1;
      lw[i] = lw[i - 1];
    } else {
      lb[i] = lb[i - 1];
      lw[i] = lw[i - 1] + 1;
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    if (s[i + 1] == '#')
      rw[i] = rw[i + 1];
    else
      rw[i] = rw[i + 1] + 1;
  }
  if (lw[n - 1] == n - 1 && s[n - 1] == '.') {
    cout << 0;
    return 0;
  }
  if (lb[n - 1] == n - 1 && s[n - 1] == '#') {
    cout << 0;
    return 0;
  }
  int ans = 200000;
  int tmp;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      if (rw[i] != 0 && lw[i] == 0)
        tmp = rw[i];
      else if (rw[i] == 0)
        tmp = min(lb[i], lw[i]);
      ans = min(ans, tmp);
    }
  }
  cout << ans;
  return 0;
}
