#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;
  auto f = [S, N](int mi) {
    int res = 0;
    for (int i = 0; i < N; i++) {
      if (i < mi && S[i] == '#') res++;
      if (i >= mi && S[i] == '.') res++;
    }
    return res;
  };
  int res = N;
  int lo = -1, hi = N + 1;
  while (lo < hi) {
    int mi = (lo + hi) / 2;
    if (chmin(res, f(mi))) {
      lo = mi;
    } else {
      hi = mi;
    }
  }
  cout << res << '\n';
  return 0;
}
