#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  string st;
  cin >> n >> st;
  bool find = false;
  int res1 = 0, res2 = 0;
  int aux = 0;
  int result = 0;
  int result2 = 0;
  bool start = false;
  for (int i = n; i >= 0; i--) {
    if (i < n) {
      if (st[i] == '#')
        res2++;
      else
        res1++;
    }
    if (find && i != 0) {
      if (st[i - 1] == '.') {
        if (start) {
          result += res2;
          result2 += res1;
        } else {
          if (res1 >= res2) {
            result += res2;
            result2 += res1;
            start = true;
          } else {
            result += res1;
            result2 += res2;
          }
        }
        res1 = 0;
        res2 = 0;
        find = false;
      }
    } else {
      if (st[i - 1] == '#') find = true;
    }
  }
  result += res2;
  result2 += res1;
  cout << min(result, result2) << endl;
}
