#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] == '#') {
      int k1 = i;
      while (S[k1] == '#') {
        cnt1++;
        k1++;
      }
      A.push_back(cnt1);
      cnt1 = 0;
      i = k1;
    } else {
      int k2 = i;
      while (S[k2] == '.') {
        cnt2++;
        k2++;
      }
      B.push_back(cnt2);
      cnt2 = 0;
      i += k2;
    }
  }
  if (A.size() < B.size())
    A.push_back(0);
  else if (A.size() > B.size())
    B.push_back(0);
  for (int i = 0; i < A.size(); i++) ans += min(A[i], B[i]);
  cout << ans << endl;
}
