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