#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;
static constexpr ll LL_MOD = 1000000009;
static constexpr ll LL2_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;
static map<type_index, const char *const> scanType = {{typeid(int), "%d"},
                                                      {typeid(ll), "%lld"},
                                                      {typeid(double), "%lf"},
                                                      {typeid(char), "%c"}};
template <class T>
static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
int main(int argc, char *argv[]) {
  ll l;
  cin >> l;
  string s;
  cin >> s;
  vector<ll> v(l);
  ll count = 0;
  for (int i = 0; i < l; i++) {
    v[i] = count;
    if (s[i] == '#') count++;
  }
  if (count == 0) {
    cout << 0 << endl;
    return 0;
  }
  count = 0;
  ll minCount = 999999999;
  for (int i = l - 1; i >= 0; i--) {
    if (s[i] == '.') count++;
    v[i] += count;
    if (v[i] < minCount) minCount = v[i];
  }
  if (count == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << minCount << endl;
  return 0;
}
template <class T>
static void scan(vector<T> &v) {
  auto tFormat = scanType[typeid(T)];
  for (T &n : v) {
    scanf(tFormat, &n);
  }
}
static void scan(vector<string> &v, bool isWord) {
  if (isWord) {
    for (auto &n : v) {
      cin >> n;
    }
    return;
  }
  int i = 0, size = static_cast<int>(v.size());
  string s;
  getline(cin, s);
  if (s.size() != 0) {
    i++;
    v[0] = s;
  }
  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}
