#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N;
  cin >> S;
  int count1 = 0;
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') flag = true;
    if (flag && S[i] == '.') count1++;
  }
  int count2 = 0;
  int count3 = 0;
  int temp = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '.') {
      count2++;
      temp = 0;
    } else if (S[i] == '#') {
      count3++;
      temp++;
    }
  }
  count3 -= temp;
  temp = 0;
  flag = false;
  int count4 = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      if (i > 0 && S[i - 1] == '.') {
        count4 += temp;
        temp = 0;
      }
      temp++;
    }
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '#') break;
    count4++;
  }
  if (count1 <= count2 && count1 <= count3 && count1 <= count4) {
    cout << count1 << endl;
  } else if (count2 <= count1 && count2 <= count3 && count2 <= count4) {
    cout << count2 << endl;
  } else if (count3 <= count1 && count3 <= count2 && count3 <= count4) {
    cout << count3 << endl;
  } else {
    cout << count4 << endl;
  }
  return 0;
}
