#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N;
  string S;
  cin >> N >> S;
  int blacknumber = 0, whitenumber = 0;
  for (int(i) = 0; (i) < (N); (i)++) {
    if (S[i] == '#') {
      blacknumber++;
    } else {
      whitenumber++;
    }
  }
  int tmp1 = 0, tmp2 = 0, ans = 0;
  int answer[N];
  if (S[0] == '.') {
    answer[0] = whitenumber - 1;
  } else {
    answer[0] = whitenumber + 1;
  }
  for (int(i) = (1); (i) < (N); (i)++) {
    if (S[i] == '#') {
      answer[i] = answer[i - 1] + 1;
    } else {
      answer[i] = answer[i - 1] - 1;
    }
  }
  sort(answer, answer + N);
  ans = answer[0];
  cout << ans;
  return 0;
}
