#include <bits/stdc++.h>
using namespace std;
static const int NMAX = 2 * 100005;
string s;
int whites[NMAX];
int blacks[NMAX];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  cin >> s;
  int changes = 0;
  if (s[0] == '#') {
    blacks[0] = 1;
    whites[0] = 0;
  }
  for (int i = 1; i < n; ++i) {
    if (s[i] == '#') {
      blacks[i] = blacks[i - 1] + 1;
      whites[i] = 0;
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '.') {
      whites[i] = whites[i + 1] + 1;
      blacks[i] = 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] == '#' && s[i + 1] == '.') {
      if (whites[i + 1] > blacks[i]) {
        changes += blacks[i];
      } else {
        changes += whites[i + 1];
        i += whites[i + 1];
      }
    }
  }
  cout << changes << '\n';
}
