#include <bits/stdc++.h>
using namespace std;
long long MOD = 10e9 + 7;
int main() {
  int n, count = 0;
  string s, s2;
  cin >> n;
  cin >> s;
  int black = 0, white = 0;
  for (int(i) = 0; (i) < (n - 1); (i)++) {
    if (s[i] == '#')
      black++;
    else
      white++;
    if (s[i] == '.' && s[i + 1] == '#') {
      count += min(black, white);
      black = white = 0;
    }
  }
  cout << (count) << "\n";
  ;
  return 0;
}
