#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
const long long mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> white(n, 0);
  vector<int> white_sum(n + 1);
  vector<int> black(n, 0);
  vector<int> black_sum(n + 1);
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '.') white[i] = 1;
    if (s[i] == '#') black[i] = 1;
  }
  for (long long int i = 1; i < n + 1; i++) {
    white_sum[i] = white[i - 1] + white_sum[i - 1];
    black_sum[i] = black[i - 1] + black_sum[i - 1];
  }
  int ans_min = N;
  for (long long int i = 0; i < n + 1; i++) {
    int ans = (i - (white_sum[n] - white_sum[(n - i)])) +
              ((n - i) - (black_sum[n] - black_sum[i]));
    ans_min = min(ans, ans_min);
  }
  cout << ans_min << endl;
}
