#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  string s;
  cin >> s;
  string S = s + '.';
  int count = 0;
  vector<int> V;
  vector<int> V1(N + 1);
  for (int i = 0; i < N + 1; i++) {
    if (S[i] == '#') count++;
    V1[i] = count;
    if (S[i] == '#' && S[i + 1] == '.') V.push_back(i);
  }
  int siz = V.size();
  int ans = 200005;
  if (siz == 0)
    cout << 0 << endl;
  else {
    for (int i = 0; i < siz; i++) {
      ans = min(ans, V1[V[i]] + N + 1 - V[i] - 1 - (V1[N - 1] - V1[i]));
    }
    cout << ans - 1 << endl;
  }
}
