#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const int MAX = 510000;
const long long MOD = 1000000007;
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long ans = 0, tmp = 0;
  for (long long i = (0); i < (n - 1); ++i) {
    if (s[i] == '#' && s[i + 1] == '.') {
      tmp = 1;
    }
    if (s[i] == '.') {
      if (s[i + 1] == '.') {
        if (tmp > 0) tmp++;
      } else {
        ans += tmp;
        tmp = 0;
      }
    }
  }
  ans += tmp;
  long long b = 0;
  for (long long i = (n - 1); i >= (0); --i) {
    if (s[i] == '#')
      b++;
    else
      break;
  }
  cout << min(ans, n - b - ans) << endl;
}
