#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> sum;
  int cnt = 1;
  char prev = '&';
  for (int i = 0; i < n; i++) {
    if (s[i] != prev) {
      if (prev == '#') {
        sum.push_back(cnt * -1);
      } else if (prev == '.') {
        sum.push_back(cnt);
      }
      cnt = 1;
    } else {
      cnt++;
    }
    prev = s[i];
  }
  if (prev == '#') {
    sum.push_back(cnt * -1);
  } else if (prev == '.') {
    sum.push_back(cnt);
  }
  int xcMin = 1000000;
  if (s[0] == '.') {
    for (int i = 2; i < sum.size(); i++) {
      int xc = 0;
      bool hoge = true;
      for (int j = 1; j < sum.size(); j++) {
        if (i == j) {
          hoge = false;
        }
        if (j % 2 == 0 && !hoge) {
          xc += sum[j];
        } else if (j % 2 == 1 && hoge) {
          xc += sum[j] * -1;
        }
      }
      xcMin = min(xcMin, xc);
    }
  } else {
    for (int i = 1; i < sum.size(); i++) {
      int xc = 0;
      bool hoge = true;
      for (int j = 0; j < sum.size(); j++) {
        if (i == j) {
          hoge = false;
        }
        if (j % 2 == 0 && hoge) {
          xc += sum[j] * -1;
        } else if (j % 2 == 1 && !hoge) {
          xc += sum[j];
        }
      }
      xcMin = min(xcMin, xc);
    }
  }
  bool st = false;
  int wc = 0;
  for (int i = 0; i < n; i++) {
    if (st) {
      if (s[i] == '.') {
        wc++;
      }
    } else {
      if (s[i] == '#') {
        st = true;
      }
    }
  }
  st = false;
  int bc = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (st) {
      if (s[i] == '#') {
        bc++;
      }
    } else {
      if (s[i] == '.') {
        st = true;
      }
    }
  }
  cout << min({bc, wc, xcMin}) << endl;
}
