#include <bits/stdc++.h>
using namespace std;
void ioinit() {
  ios::sync_with_stdio(0);
  cin.tie(0);
}
int main() {
  ioinit();
  int N, ans;
  string S;
  vector<int> black;
  cin >> N >> S;
  ans = N;
  black.push_back((S[0] == '#') ? 1 : 0);
  for (int i = 1; i < N; i++) {
    black.push_back(black[i - 1]);
    if (S[i] == '#') black[i]++;
  }
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      ans = min(ans, 2 * black[i] - black[N - 1] + N - i - 2);
    }
  }
  cout << ans << endl;
}
