#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string S;
  cin >> S;
  int ans = 0;
  bool cnt_flag = false;
  bool seq_black = false;
  int black_cnt = 0;
  bool seq_white = false;
  int white_cnt = 0;
  for (auto c : S) {
    if (!cnt_flag && c == '#') {
      cnt_flag = true;
      seq_black = true;
      black_cnt += 1;
      continue;
    }
    if (seq_black && c == '#') black_cnt += 1;
    if (seq_black && c == '.') {
      seq_black = false;
      seq_white = true;
      white_cnt += 1;
      continue;
    }
    if (seq_white && c == '.') white_cnt += 1;
    if (seq_white && c == '#') {
      ans += min(black_cnt, white_cnt);
      seq_white = false;
      seq_black = true;
      black_cnt = 1;
      white_cnt = 0;
    }
  }
  ans += min(black_cnt, white_cnt);
  reverse(S.begin(), S.end());
  int _ans;
  cnt_flag = false;
  seq_black = false;
  black_cnt = 0;
  seq_white = false;
  white_cnt = 0;
  for (auto c : S) {
    if (!cnt_flag && c == '.') {
      cnt_flag = true;
      seq_white = true;
      white_cnt += 1;
      continue;
    }
    if (seq_white && c == '.') white_cnt += 1;
    if (seq_white && c == '#') {
      seq_white = false;
      seq_black = true;
      black_cnt += 1;
      continue;
    }
    if (seq_black && c == '#') black_cnt += 1;
    if (seq_black && c == '.') {
      _ans += min(black_cnt, white_cnt);
      seq_white = true;
      seq_black = false;
      black_cnt = 0;
      white_cnt = 1;
    }
  }
  _ans += min(black_cnt, white_cnt);
  cout << min(ans, _ans) << endl;
}
