#include <bits/stdc++.h>
using namespace std;
char S[200010];
int B[200010];
int main() {
  int i;
  int N;
  int X;
  int iB;
  int iW;
  int iMin;
  char C;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  cin >> S;
  i = 0;
  iB = 0;
  while (C = S[i]) {
    if (C == '#') iB++;
    B[i] = iB;
    i++;
  }
  iW = N - iB;
  iMin = min(iB, iW);
  for (i = 0; i < N; i++) {
    X = iW - i + 2 * B[i];
    iMin = min(iMin, X);
  }
  cout << iMin << endl;
  return 0;
}
