#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans1, ans2;
  ans1 = ans2 = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') ans1++;
  }
  int key;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      key = i;
      break;
    }
  }
  for (int i = key; i < N; i++) {
    if (S[i] == '.') ans2++;
  }
  int ans4;
  ans4 = min(ans1, ans2);
  int ans3;
  vector<int> data(N, 0);
  vector<int> ans(N, 0);
  int h = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') {
      data[h] = i;
      h++;
    }
  }
  for (int i = 0; i < h; i++) {
    ans[i] = i + N - 1 - ans[i] - (h - 1 - i);
  }
  ans3 = ans[0];
  for (int i = 1; i < h; i++) {
    if (ans[i] < ans3) ans3 = ans[i];
  }
  cout << min(ans4, ans3) << endl;
  return 0;
}
