#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  bool start = false;
  int b = 0, w = 0;
  for (int i = 0; i < int(n); i++) {
    if (s[i] == '#') start = true;
    if (start && s[i] == '.') w++;
  }
  start = false;
  for (int i = n - 1; 0 <= i; i--) {
    if (s[i] == '.') start = true;
    if (start && s[i] == '#') b++;
  }
  int cnt = 0;
  for (int i = 0; i < int(n); i++)
    if (s[i] == '.') cnt++;
  int count = 0;
  for (int i = 0; i < int(cnt); i++)
    if (s[i] == '#') count++;
  cout << min({b, w, count * 2});
  cout << "\n";
  return 0;
}
