#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> pos;
  for (int i = 0; i < n; i++) {
    if (s[i] == '#') {
      pos.push_back(i);
    }
  }
  pos.push_back(n);
  int ans1 = 0;
  for (int i = 0; i < pos.size() - 1; i++) {
    ans1 += (pos[i + 1] - pos[i] - 1);
  }
  vector<int> ppos;
  ppos.push_back(-1);
  for (int i = 0; i < n; i++) {
    if (s[i] == '.') {
      ppos.push_back(i);
    }
  }
  int ans2 = 0;
  for (int i = 0; i < ppos.size() - 1; i++) {
    ans2 += (ppos[i + 1] - ppos[i] - 1);
  }
  cout << min(ans2, ans1) << endl;
}
