#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int count_b[n + 5];
  int count_w[n + 5];
  count_b[0] = 0;
  count_w[0] = 0;
  bool b_flag = false;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      if (s[i] == '#') {
        count_b[0] += 1;
      } else {
        count_w[0] += 1;
      }
      continue;
    }
    if (s[i] == '#') {
      count_b[i] = count_b[i - 1] + 1;
      count_w[i] = count_w[i - 1];
      b_flag = true;
    } else {
      count_w[i] = count_w[i - 1] + 1;
      count_b[i] = count_b[i - 1];
    }
  }
  int sum[n + 1];
  for (int i = 0; i < n; ++i) {
    sum[i] = count_b[i] + (count_w[n - 1] - count_w[i]);
  }
  sort(sum, sum + n);
  int ans = sum[0];
  if (count_w[n - 1] == n) {
    ans = 0;
  }
  cout << ans << endl;
}
