#include <bits/stdc++.h>
using namespace std;
long long int A[5000001];
vector<long long int> v;
vector<pair<long long int, long long int> > v2;
int main() {
  long long int n, k, white = 0, black = 0, ans = 0;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    black = 0, white = 0;
    if (s[i] == '#') {
      while (s[i] != '.') {
        i++, black++;
        if (i == s.size()) goto x;
      }
      while (s[i] != '#') {
        i++, white++;
        if (i == s.size()) {
          ans += min(black, white);
          goto x;
        }
      }
      ans += min(black, white);
      i--;
    }
  }
x:
  cout << ans << endl;
  return 0;
}
