#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  int n;
  string s;
  cin >> n >> s;
  int cta = 0;
  for (int i = 0; i < (long long)n; ++i)
    if (s[i] == '.') cta++;
  int ans = min(n - cta, cta);
  int b = 0, w = 0;
  for (int i = n - 1 - 1; i >= 0; --i) {
    if (s[i] == '#')
      b++;
    else
      w++;
    if (s[i] != s[i + 1]) {
      int x = b;
      int y = cta - w;
      ans = min(ans, x + y);
    }
  }
  cout << ans << endl;
}
int main(void) { solve(); }
