#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  vector<int> A = {};
  vector<int> B = {};
  int cnt1 = 0;
  int cnt2 = 0;
  if (S[0] == '.') A.push_back(0);
  for (int i = 0; i < N;) {
    if (S[i] == '#') {
      while (S[i] == '#') {
        cnt1++;
        i++;
      }
      A.push_back(cnt1);
      cnt1 = 0;
    } else {
      while (S[i] == '.') {
        cnt2++;
        i++;
      }
      B.push_back(cnt2);
      cnt2 = 0;
    }
  }
  if (A.size() < B.size())
    A.push_back(0);
  else if (A.size() > B.size())
    B.push_back(0);
  if (A[0] == 0)
    ans += min(A[1], B[1]);
  else
    ans += min(A[0], B[0]);
  int cnt = 0;
  int kioku = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '.')
      cnt++;
    else {
      ans += cnt;
      if (cnt != 0) kioku = cnt;
      cnt = 0;
    }
  }
  cout << ans - kioku << endl;
}
