#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001001001001001;
const int MOD = 1000000007;
template <typename T>
void print(const T &v);
int main() {
  int n;
  cin >> n;
  string sss, ss, s;
  cin >> sss;
  s = sss;
  ss = sss;
  for (int i = 0; i < n; i++) {
    if (s[i] != '#') {
      s[i] = '-';
    } else {
      break;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] != '.') {
      s[i] = '-';
    } else {
      break;
    }
  }
  int black = 0;
  int white = 0;
  for (char c : s) {
    if (c == '#') {
      ++black;
    } else if (c == '.') {
      ++white;
    }
  }
  int ans1 = min(black, white);
  sort(ss.begin(), ss.end());
  reverse(ss.begin(), ss.end());
  int ans2 = 0;
  for (int i = 0; i < n; i++) {
    if (ss[i] != sss[i]) {
      ++ans2;
    }
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}
template <typename T>
void print(T const &v) {
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << ' ';
    cout << v[i];
  }
  cout << endl;
}
