#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count_a = 0, count_b = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') {
      count_a += 1;
    } else {
      count_b += 1;
    }
  }
  S[N] = '0';
  int a = 0, b = 0;
  if (S[0] == '.') {
    a = 1;
  }
  if (S[N - 1] == '#') {
    b = 1;
  }
  int count_c = 0, count_d = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == S[0]) {
      count_c += 1;
    } else {
      break;
    }
  }
  for (int i = N - 1; i > -1; i -= 1) {
    if (S[i] == S[N - 1]) {
      count_d += 1;
    } else {
      break;
    }
  }
  int change_1, change_2;
  if (a == 1 && b == 1) {
    change_1 = count_a - count_c;
    change_2 = count_b - count_d;
  }
  if (a == 1 && b == 0) {
    change_1 = count_d + count_b;
    change_2 = count_a - count_c;
  }
  if (a == 0 && b == 1) {
    change_1 = count_b - count_d;
    change_2 = count_c + count_a;
  }
  if (a == 0 && b == 0) {
    change_1 = count_a + count_c;
    change_2 = count_b + count_d;
  }
  int change_a, change_b;
  if (change_1 < count_a) {
    change_a = change_1;
  } else {
    change_a = count_a;
  }
  if (change_2 < count_b) {
    change_b = change_2;
  } else {
    change_b = count_b;
  }
  int change;
  if (change_a < change_b) {
    change = change_a;
  } else {
    change = change_b;
  }
  cout << change << endl;
  return 0;
}
