#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  s = '.' + s;
  s.push_back('#');
  n += 2;
  int most_right_white;
  int most_left_black;
  int white_cnt = -1;
  int black_cnt = -1;
  for (int i = 0; i < n; i++) {
    if (s[i] == '.') {
      most_right_white = i;
      white_cnt++;
    } else {
      black_cnt++;
    }
    if (s[n - 1 - i] == '#') most_left_black = n - 1 - i;
  }
  int plan1 = 0;
  for (int i = 1; i < most_right_white; i++) {
    if (s[i] == '#') plan1++;
  }
  int plan2 = 0;
  for (int i = most_left_black + 1; i <= n; i++) {
    if (s[i] == '.') plan2++;
  }
  int ans = min({plan1, plan2, white_cnt, black_cnt});
  cout << ans << endl;
}
