#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int ans = 0;
  int w = 0, b = 0;
  for (int(i) = 0; (i) < (N); (i)++) {
    while (s[i] == '#') b++, i++;
    while (s[i] == '.') w++, i++;
    i--;
    ans += min(w, b);
    b = 0, w = 0;
  }
  cout << ans << endl;
}
