#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int b = -1, w = -1;
  bool black = false;
  vector<pair<int, int> > p;
  for (int i = 0; i < (N); i++) {
    if (S[i] == '#' && b == -1) b = i;
    if (S[i] == '.' && b != -1 && w == -1) w = i;
    if (S[i] == '#' && w != -1) {
      p.push_back(pair<int, int>(w - b, i - w));
      b = i;
      w = -1;
    }
  }
  if (b != -1 && w != -1) {
    p.push_back(pair<int, int>(w - b, N - w));
  }
  int M = p.size();
  if (M == 0) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> B(M), W(M);
  for (int i = 0; i < (M); i++) {
    if (i == 0)
      B[i] = p[i].first;
    else
      B[i] = B[i - 1] + p[i].first;
  }
  for (int i = ((int)(M)-1); i >= 0; i--) {
    if (i == M - 1)
      W[i] = p[i].second;
    else
      W[i] = W[i + 1] + p[i].second;
  }
  int ans = INT_MAX;
  for (int i = 0; i < (M); i++) {
    if (i == 0)
      ans = min(ans, W[i]);
    else
      ans = min(ans, B[i - 1] + W[i]);
  }
  cout << ans << endl;
}
