#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % 1000000007 + 1000000007) % 1000000007) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += 1000000007 - a.x) >= 1000000007) x -= 1000000007;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= 1000000007;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(1000000007 - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
long long in() {
  long long x;
  cin >> x;
  return x;
}
string stin() {
  string s;
  cin >> s;
  return s;
}
signed main() {
  long long n = in();
  string s = stin();
  bool is_all_black = true;
  bool is_all_white = true;
  long long black_count = 0;
  long long white_count = 0;
  long long right_black_count = 0;
  long long left_white_count = 0;
  bool is_continuous_white = true;
  for (long long i = 0; i < n; ++i) {
    if (s[i] == '#') {
      is_all_white = false;
      is_continuous_white = false;
      ++black_count;
    } else {
      is_all_black = false;
      if (is_continuous_white) ++left_white_count;
      ++white_count;
    }
  }
  if (is_all_black || is_all_white) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = n - 1; i >= 0; --i) {
    if (s[i] == '#')
      ++right_black_count;
    else
      break;
  }
  black_count -= right_black_count;
  white_count -= left_white_count;
  cout << min(black_count, white_count);
  cout << "\n";
  return 0;
}
