#include <bits/stdc++.h>
using namespace std;
template <typename T>
class vec2d : public vector<vector<T>> {
 public:
  vec2d(int H, int W) : vector<vector<T>>(H, vector<T>(W)) {}
};
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  for (int i = (0); i < (vec.size()); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  }
  return os;
}
struct aaa {
  aaa() {
    cin.tie(0);
    ios::sync_with_stdio(0);
  };
} aaaaaaa;
signed main(signed argc, char** argv) {
  int N;
  cin >> N;
  char S[N + 1];
  cin >> S;
  int mode = -1;
  int ans = 0;
  int s = 0;
  int d = 0;
  vector<int> ss;
  vector<int> dd;
  ss.reserve(N);
  dd.reserve(N);
  for (int i = 0; i < N; i++) {
    if (mode == 0) {
      if (S[i] == '#') {
        s++;
      } else {
        mode = 1;
        d++;
        if (i == N - 1) {
          ans += (s > d ? d : s);
          ss.push_back(s);
          dd.push_back(d);
        }
      }
    } else if (mode == 1) {
      if (S[i] == '#') {
        ans += (s > d ? d : s);
        ss.push_back(s);
        dd.push_back(d);
        s = 1;
        d = 0;
        mode = 0;
      } else {
        d++;
        if (i == N - 1) {
          ans += (s > d ? d : s);
          ss.push_back(s);
          dd.push_back(d);
        }
      }
    } else {
      if (S[i] == '#') {
        s++;
        mode = 0;
      }
    }
  }
  int sums = accumulate(ss.begin(), ss.end(), 0);
  int sumd = accumulate(dd.begin(), dd.end(), 0);
  cout << (sums < sumd ? sums : sumd) << endl;
  return 0;
}
