#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int output = 0;
  int index = 0;
  while (index < N) {
    int b = 0, w = 0;
    while (S[index] == '#') {
      b++;
      index++;
    }
    while (S[index] == '.') {
      w++;
      index++;
    }
    output += min(b, w);
  }
  vector<int> b_acc(N, 0);
  vector<int> w_acc(N, 0);
  int b = 0, w = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      b++;
    } else {
      w++;
    }
    b_acc[i] = b;
    w_acc[N - i - 1] = w;
  }
  for (int i = 0; i < N - 1; i++) {
    output = min(output, b_acc[i] + w_acc[i + 1]);
  }
  cout << output << endl;
  return 0;
}
