#include <bits/stdc++.h>
using namespace std;
vector<int> g[1000001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int c = 0, n, s1 = 0, s2 = 0, x3, x4, s3 = 0, s4 = 0;
  string s;
  cin >> n >> s;
  vector<pair<char, int>> v;
  for (int i = 0; i < n;) {
    if (s[i] == '#') {
      c = 0;
      while (s[i] == '#' && i < n) {
        c++;
        i++;
      }
      v.emplace_back('#', c);
      s1 += c;
    }
    if (s[i] == '.') {
      c = 0;
      while (s[i] == '.' && i < n) {
        c++;
        i++;
      }
      v.emplace_back('.', c);
      s2 += c;
    }
  }
  x3 = s1;
  x4 = s2;
  int l = (int)v.size(), x = 0, y = 0;
  if (v[l - 1].first == '.' && l >= 2) {
    x3 += v[l - 1].second;
    x += v[l - 1].second + v[l - 2].second;
    x4 -= v[l - 1].second;
    s3 += v[l - 1].second;
    s4 += v[l - 1].second;
  }
  if (v[0].first == '#' && l >= 2) {
    x4 += v[1].second;
    y += v[0].second + v[1].second;
    x3 -= v[0].second;
    s3 += v[0].second;
    s4 += v[0].second;
  }
  s3 += x3 - x;
  s4 += x4 - y;
  cout << min({s1, s2, s3, s4});
  return 0;
}
