#include <bits/stdc++.h>
using namespace std;
void rle(const string& s, vector<pair<char, long long>>& out) {
  out.clear();
  if (s.size() == 0) {
    return;
  }
  long long num = 1;
  for (long long i = 1; i < s.size(); ++i) {
    if (s.at(i) != s.at(i - 1)) {
      out.emplace_back(s.at(i - 1), num);
      num = 1;
    } else {
      num++;
    }
  }
  out.emplace_back(s.back(), num);
}
void solve(long long N, std::string S) {
  vector<pair<char, long long>> x;
  rle(S, x);
  long long ans_b = 0;
  for (long long i = 0; i < (x.size()); ++i) {
    if (i + 1 < x.size() && x.at(i).first == '#') {
      ans_b += x.at(i).second;
    }
  }
  long long ans_w = 0;
  for (long long i = 1; i < x.size(); ++i) {
    if (x.at(i).first == '.') {
      ans_w += x.at(i).second;
    }
  }
  cout << min(ans_b, ans_w) << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}
