#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, n, m, l, f, x, y, z;
  string s;
  cin >> n >> s;
  int white[200005] = {0};
  int black[200005] = {0};
  for (i = 0; i < n; i++) {
    if (s[i] == '.') {
      white[i + 1] += white[i];
      ++white[i + 1];
    }
    if (s[n - 1 - i] == '#') {
      black[n - 1 - i] += black[n - i];
      ++black[n - 1 - i];
    }
  }
  int ans = 0;
  for (i = 0; i < n + 1; i++) {
    ans = max(ans, white[i] + black[i]);
  }
  cout << n - ans << endl;
}
