#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  string a;
  cin >> a;
  vector<long long> white;
  vector<long long> black;
  long long temp = 0;
  for (int z = 0; z < a.size(); z++) {
    if (a[z] == '#') {
      if (temp != 0) white.push_back(temp);
      temp = 0;
    } else {
      temp++;
    }
  }
  if (temp != 0) {
    white.push_back(temp);
  }
  temp = 0;
  for (int z = 0; z < a.size(); z++) {
    if (a[z] == '.') {
      if (temp != 0) black.push_back(temp);
      temp = 0;
    } else {
      temp++;
    }
  }
  if (temp != 0) {
    black.push_back(temp);
  }
  if (black.size() < white.size()) {
    black.push_back(0);
  }
  if (white.size() < black.size()) {
    white.push_back(0);
  }
  long long answer = 0;
  for (int z = 0; z < black.size(); z++) {
    answer += black[z];
  }
  temp = answer;
  for (int z = black.size() - 1; z > -1; z--) {
    temp += white[z];
    temp -= black[z];
    answer = min(answer, temp);
  }
  cout << answer << endl;
  cin >> n;
}
