#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
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 ans = 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;
  if (ans > count2) ans = count2;
  if (ans > count3) ans = count3;
  temp = -1;
  for (int i = 0; i < N; i++) {
    if (temp == -1 && S[i] == '#') {
      temp = i;
    }
    if (temp != -1 && S[i] == '.') {
      v.push_back(make_pair(temp, i - 1));
      temp = -1;
    }
  }
  if (temp != -1) {
    v.push_back(make_pair(temp, N - 1));
  }
  int c1 = 0;
  for (int i = 0; i < v.size() / 2; i++) {
    pair<int, int> pi = v[i];
    c1 += pi.second - pi.first + 1;
    int c2 = 0;
    for (int j = i + 1; j < v.size() - 1; j++) {
      pair<int, int> pj = v[j];
      pair<int, int> pjj = v[j + 1];
      c2 += pjj.first - pj.second - 1;
    }
    if (S[N - 1] == '.') c2 += N - v[v.size() - 1].second - 1;
    int a = c1 + c2;
    if (ans > a) ans = a;
  }
  int count4 = 0;
  cout << ans << endl;
  return 0;
}
