#include <bits/stdc++.h>
constexpr long long MOD = 1000000007;
int main() {
  int N;
  std::cin >> N;
  std::string s;
  std::cin >> s;
  N = s.size();
  std::vector<int> accB(N, 0);
  std::vector<int> accW(N, 0);
  int cB = 0;
  int cW = 0;
  for (int i = 0; i < N; ++i) {
    if (s[i] == '.')
      ++cW;
    else
      ++cB;
    accB[i] = cB;
    accW[i] = cW;
  }
  int i = N - 1;
  while (0 <= i && s[i] == '#') --i;
  if (i < 0) {
    std::cout << 0 << std::endl;
    return 0;
  }
  int ans = INT_MAX;
  int count = 0;
  while (0 <= i) {
    int j = i;
    while (0 <= j && s[j] == '.') --j;
    if (j < 0) {
      ans = std::min(ans, count);
      break;
    }
    ans = std::min(ans, accB[j] + count);
    count += i - j;
    while (0 <= j && s[j] == '#') --j;
    i = j;
  }
  std::cout << ans << std::endl;
  return 0;
}
