#include <bits/stdc++.h>
using namespace std;
static const long long maxLL = (long long)1 << 62;
const long long MOD = 1000000007;
const long long INF = 1e18;
int ca[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
signed main() {
  int n;
  string s, s1;
  cin >> n >> s;
  s1 = s;
  int black = 0, white = 0;
  int cntb[200005], cntw[200005], cntw2[200005];
  memset(cntb, 0, sizeof(cntb));
  memset(cntw, 0, sizeof(cntw));
  memset(cntw2, 0, sizeof(cntw2));
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '.') {
      white++;
    }
    cntw[i] = white;
  }
  white = 0;
  black = 0;
  bool flag = false, flag2 = false;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == '#') {
      if (flag == true) black++;
      if (flag == true) flag2 = true;
    } else {
      flag = true;
      if (flag2 == true) white++;
    }
    cntb[i] = black;
    cntw2[i] = white;
  }
  int task = 0, minn = 99999999;
  vector<int> ans;
  int index = 0;
  int white2 = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '.') {
      white2++;
    }
  }
  ans.push_back(white2);
  ans.push_back(black);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '#') {
      s[i] = '.';
      task++;
      for (int j = index; j < s.length(); j++) {
        if (s[j] == '#') {
          index = j;
          break;
        }
      }
      ans.push_back(min(task + cntw[index], task + cntb[i]));
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
  getchar();
  getchar();
  return 0;
}
