#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  string S;
  cin >> N;
  cin >> S;
  long long sum = 0;
  long long index = 0;
  long long index2 = 0;
  long long renzoku_dot = 0;
  long long renzoku_sharp = 0;
  long long mae = '#';
  long long res = 0;
  for (long long i = N - 1; i >= 0; i--) {
    if (S[i] == '.') {
      if (mae == '.') {
        renzoku_dot++;
      } else {
        if (renzoku_dot != 0) {
          if (renzoku_dot <= renzoku_sharp) {
            res += renzoku_dot;
            renzoku_dot = 1;
            renzoku_sharp = 0;
          } else {
            index2 = i + renzoku_dot + renzoku_sharp;
            break;
          }
        } else {
          renzoku_sharp = 0;
          renzoku_dot = 1;
        }
      }
      mae = '.';
    } else {
      mae = '#';
      renzoku_sharp++;
    }
    if (i == 0) index2 = 0;
  }
  mae = '.';
  renzoku_dot = 0;
  renzoku_sharp = 0;
  for (long long i = 0; i < N; i++) {
    if (S[i] == '#') {
      if (mae == '#') {
        renzoku_sharp++;
      } else {
        if (renzoku_sharp != 0) {
          if (renzoku_dot >= renzoku_sharp) {
            res += renzoku_sharp;
            renzoku_dot = 1;
            renzoku_sharp = 0;
          } else {
            index = i - renzoku_dot - renzoku_sharp;
          }
        } else {
          renzoku_sharp = 1;
          renzoku_dot = 0;
        }
      }
      mae = '#';
    } else {
      mae = '.';
      renzoku_dot++;
    }
    if (i == N - 1) index = N - 1;
  }
  long long count1 = 0;
  long long count2 = 0;
  for (long long i = index; i <= index2; i++) {
    if (S[i] == '.') {
      count1++;
    } else {
      count2++;
    }
  }
  cout << res + min(count1, count2) << endl;
  return 0;
}
