#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO = (long double)(1 + sqrt(5)) / 2;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
  int N;
  string second;
  cin >> N >> second;
  vector<int> stone;
  int cnt = 1;
  for (int i = 0; i < int(N - 1); ++i) {
    if (second[i] != second[i + 1]) {
      stone.push_back(cnt);
      cnt = 1;
    } else
      cnt++;
  }
  stone.push_back(cnt);
  int b = 0, w = 0, si = 0;
  for (auto i = stone.begin(); i != stone.end(); i++) {
    if (second[si] == '.')
      w += *i;
    else
      b += *i;
    si += *i;
  }
  if (second[0] == '.') w -= stone[0];
  if (second[N - 1] == '#') b -= stone[stone.size() - 1];
  cout << min(w, b) << endl;
}
