#include <bits/stdc++.h>
using namespace std;
int n, white[200005], black[200005];
string s;
inline void init() {
  memset(white, 0xff, sizeof(white));
  memset(black, 0xff, sizeof(black));
  cin >> n >> s;
  int tmp = 0, ans = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '.') {
      ans += tmp;
      tmp = 0;
      white[i] = ans;
    } else
      ++tmp;
  }
  tmp = 0, ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '#') {
      ans += tmp;
      tmp = 0;
      black[i] = ans;
    } else
      ++tmp;
  }
  int ANS = 200005 + 1000, TT = 0;
  for (int i = 0; i < n; ++i) {
    if (white[i] != -1) {
      ANS = min(ANS, white[i] + TT);
      ++TT;
    }
  }
  TT = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (black[i] != -1) {
      ANS = min(ANS, black[i] + TT);
      ++TT;
    }
  }
}
inline void solve() { cout << '\n'; }
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  init();
  solve();
  return 0;
}
