#include <bits/stdc++.h>
using namespace std;
const long long P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int main() {
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int black = 0;
  int white = 0;
  int rightwhite = 0;
  int leftblack = 0;
  for (int i = (0); i < (N); ++i) {
    if (S[i] == '#') {
      black++;
    } else {
      white++;
    }
  }
  for (int i = N - 1; i > -1; i--) {
    if (S[i] == '.') {
      rightwhite = i;
      break;
    }
  }
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      leftblack = i;
      break;
    }
  }
  int ans = min(white - leftblack, black - rightwhite + N - 1);
  cout << ans << endl;
  return 0;
}
