#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
using vc = vector<char>;
using vvc = vector<vc>;
long long dx[4] = {0, 1, 0, -1};
long long dy[4] = {1, 0, -1, 0};
int main() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long ku = 0;
  long long si = 0;
  while (s[(int)(s).size() - 1] == '#') {
    s.pop_back();
    n--;
  }
  vector<pair<long long, long long> > p(n);
  for (long long i = 0; i < (n); i++) {
    if (s[i] == '#') ku++;
    if (s[i] == '.') si++;
  }
  long long kuro = 0;
  long long siro = 0;
  for (long long i = 0; i < (n); i++) {
    if (s[i] == '#') {
      kuro++;
      p[i].first = kuro;
    } else {
      siro++;
      p[i].second = siro;
    }
  }
  long long ans = INF;
  for (long long i = 0; i < (n); i++) {
    ans = min(ans, p[i].first + si - p[i].second);
  }
  cout << (ans) << endl;
}
