#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
string join(const T &v, const string delim = ",") {
  if (v.empty()) return "";
  ostringstream res;
  res << v[0];
  for (int i = 1; i < v.size(); i++) {
    res << delim << v[i];
  }
  return res.str();
}
int f(const string &S, const vector<int> c, const int N, int l, int r) {
  if (l >= N || r <= 0 || l >= r) return 0;
  int res = 100100100;
  chmin(res, c[r] - c[l]);
  chmin(res, (r - l) - (c[r] - c[l]));
  int l2 = l;
  int r2 = r;
  while (l2 < N && S[l2] == '.') l2++;
  while (r2 > 0 && S[r2 - 1] == '#') r2--;
  chmin(res, f(S, c, N, l2 + 1, r2) + 1);
  chmin(res, f(S, c, N, l2, r2 - 1) + 1);
  cerr << l << "," << r << " : " << res << endl;
  return res;
}
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<int> c(N + 1, 0);
  for (ll i = (ll)(0); i < (ll)(N); i++)
    c[i + 1] = c[i] + (S[i] == '#' ? 1 : 0);
  cout << f(S, c, N, 0, N) << endl;
}
