#include <bits/stdc++.h>
int count_edge(char *S, int N) {
  int count = 1;
  for (int i = 0; i < N - 1; i++) {
    if (S[i] == '.' && S[i + 1] == '#') count++;
  }
  return count;
}
void scan_bw(char *S, int *black, int *white, int N, int count) {
  for (int i = 0; i < count; i++) {
    black[i] = 0;
    white[i] = 0;
  }
  int j = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      black[j]++;
    } else if (S[i] == '.') {
      white[j]++;
      if (i != N - 1 && S[i + 1] == '#') j++;
    }
  }
}
int main() {
  int N;
  scanf("%d", &N);
  char S[N + 1];
  scanf("%s", S);
  const int count = count_edge(S, N);
  int black[count];
  int white[count];
  scan_bw(S, black, white, N, count);
  int sum_left_black[count];
  int sum_right_white[count];
  sum_left_black[0] = black[0];
  sum_right_white[count - 1] = white[count - 1];
  for (int i = 1; i < count; i++) {
    sum_left_black[i] = black[i] + sum_left_black[i - 1];
    sum_right_white[count - i - 1] =
        white[count - i - 1] + sum_right_white[count - i];
  }
  int min_stone = sum_right_white[0];
  for (int i = 0; i < count - 1; i++) {
    int stone = sum_left_black[i] + sum_right_white[i];
    if (stone < min_stone) min_stone = stone;
  }
  if (sum_left_black[count - 1] < min_stone)
    min_stone = sum_left_black[count - 1];
  printf("%d\n", min_stone);
  return 0;
}
