#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int head;
  int minn = 1e8;
  int dem = 0;
  vector<int> sum(n);
  if (s[0] == '#')
    sum[0] = 1;
  else
    sum[0] = 0;
  for (int i = 1; i < n; ++i) {
    sum[i] = sum[i - 1];
    if (s[i] == '#') sum[i]++;
  }
  for (int i = n - 1; i >= 0; --i) {
    head = i;
    head++;
    int ans = sum[head - 1];
    minn = min(min(ans, head - ans) + min(dem, n - i - dem), minn);
    if (s[i] == '.') dem++;
  }
  cout << minn;
  return 0;
}
