#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  auto r = b % a;
  return (r ? gcd(r, a) : a);
}
int main() {
  int N;
  string S;
  cin >> N >> S;
  int white = 0, black = 0;
  for (auto i : S) {
    if (i == '#')
      black++;
    else
      white++;
  }
  auto it = S.rbegin();
  bool pre = true;
  int cnt = 0, now = 0, nowbr = black, min = 99999999;
  while (it != S.rend()) {
    if (!pre && *it == '#') {
      if (cnt + nowbr < min) min = cnt + nowbr;
      now = cnt;
      pre = true;
    } else if (pre && *it == '.') {
      if (now + nowbr < min) min = now + nowbr;
      pre = false;
    }
    if (*it == '#') nowbr--;
    ++it;
    cnt++;
  }
  cout << min << endl;
  return 0;
}
