#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)(1e18) + 1;
const int INF_INT = 2147483647 - 1e6 - 1;
const long long int mod = 1000000007ll;
const int mod_int = 1000000007;
long long int N;
string S;
long long int ans = 0;
void solve() {
  int black_detected = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == '#') black_detected = 1;
    if (S[i] == '.' && black_detected) ans++;
  }
  long long int white_detected = 0;
  long long int last_black_sequence_length = 0;
  long long int black_counter = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '#') {
      if (white_detected == 0) last_black_sequence_length++;
      black_counter++;
    } else
      white_detected = 1;
  }
  ans = min(ans, black_counter - last_black_sequence_length);
}
int main() {
  cin >> N;
  cin >> S;
  solve();
  cout << ans << endl;
  return 0;
}
