#include <bits/stdc++.h>
using namespace std;
int nx[] = {0, 1, 0, -1};
int ny[] = {0, 1, 0, -1};
int N;
int i;
int main(void) {
  cin >> N;
  char S[N + 100];
  int color[N][3];
  int white = 0;
  scanf("%s", S);
  for (i = 0; i < N; i++) {
    if (S[i] == '.') white++;
  }
  int first_b = 0, first_w = 0;
  if (S[0] == '#')
    first_b++;
  else
    first_w++;
  color[0][0] = first_w;
  color[0][1] = N - white - first_b;
  color[0][2] = color[0][1] + color[0][0];
  for (i = 1; i < N; i++) {
    if (S[i] == '.') {
      color[i][0] = color[i - 1][0] + 1;
      color[i][1] = color[i][1];
      color[i][2] = color[i][1] + color[i][0];
    } else if (S[i] == '#') {
      color[i][0] = color[i - 1][0];
      color[i][1] = color[i][1] - 1;
      color[i][2] = color[i][1] + color[i][0];
    }
  }
  int min = 10000000000;
  for (i = 0; i < N; i++) {
    if (min > color[i][2]) {
      min = color[i][2];
    }
  }
  cout << min - 1;
  return 0;
}
