#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const long long mod = 1e9 + 7;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int main() {
  ll n;
  string s;
  cin >> n >> s;
  bool flag = false;
  ll cnt1 = 0, cnt2, key = 0;
  for (ll i = 0; i < n; i++) {
    if (s[i] == '#' && !flag) {
      flag = true;
      key = i;
    }
    if (s[i] == '.' && flag) cnt1++;
  }
  cnt2 = 0;
  for (ll i = n - 1; i >= 0; i--) {
    if (s[i] == '#')
      cnt2++;
    else
      break;
  }
  cout << min(cnt1, n - key - cnt1 - cnt2);
  return 0;
}
ll gcd(ll a, ll b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
