#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int a[N + 1];
  int count = 0;
  a[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    if (S[i - 1] == '#') {
      count++;
      a[i] = count;
    } else {
      a[i] = count;
    }
  }
  int ans = N + 1;
  for (int i = 1; i < N + 1; i++) {
    ans = min(ans, 2 * a[i] + N - i - a[N]);
  }
  cout << ans << endl;
  return 0;
}
