#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  char b;
  char now;
  int kari = 0;
  int num = 0;
  int youso = 0;
  int siro[a / 2 + 1];
  int sironum = 0;
  int kuro[a / 2 + 1];
  int kuronum = 0;
  while (cin >> b) {
    if (num == 0) {
      now = b;
      youso++;
      kari = 1;
    } else {
      if (now == b) {
        kari++;
      } else {
        youso++;
        if (now == '#') {
          kuro[kuronum] = kari;
          kuronum++;
        } else {
          siro[sironum] = kari;
          sironum++;
        }
        now = b;
        kari = 1;
      }
    }
    num++;
  }
  if (now == '#') {
    kuro[kuronum] = kari;
    kuronum++;
  } else {
    siro[sironum] = kari;
    sironum++;
  }
  int ans = 0;
  int minans = a;
  if (kuronum < sironum) {
    for (int i = 0; i < kuronum - 1; i++) {
      for (int j = 0; j < i + 1; j++) {
        ans += kuro[j];
      }
      for (int j = sironum - 1; j > i; j--) {
        ans += siro[j];
      }
      if (minans > ans) {
        minans = ans;
      }
      ans = 0;
    }
  } else {
    for (int i = 0; i < sironum - 1; i++) {
      for (int j = 0; j < i + 1; j++) {
        ans += kuro[j];
      }
      for (int j = kuronum - 1; j > i; j--) {
        ans += siro[j];
      }
      if (minans > ans) {
        minans = ans;
      }
      ans = 0;
    }
  }
  cout << minans << endl;
}
