#include <bits/stdc++.h>
using namespace std;
const long long N = 300005;
int n, c, p, ans;
pair<int, int> v[200100];
string s;
int ce(int a, int b) { return (a + b - 1) / b; }
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '#') {
      v[i].first = c;
      c++;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '#') {
      v[i].second = p;
    } else
      p++;
  }
  int f = 0, ans = 200100;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '#') {
      f = 1;
      ans = min(ans, v[i].first + v[i].second);
    }
  }
  if (!f) {
    printf("0\n");
    return 0;
  }
  printf("%d\n", ans);
  return 0;
}
