#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
bool in_field(int W, int H, int x, int y) {
  return (0 <= x && x < W) && (0 <= y && y < H);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
  return s << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1) s << "\t";
  }
  return s;
}
int N;
string S;
int main() {
  cin >> N >> S;
  int dot = 0, sharp = 0;
  int ans = 0;
  int j = 0;
  priority_queue<tuple<int, pair<int, int>, int> > que;
  bool done[100000];
  memset(done, 0, sizeof(done));
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    if (S[i] == '#') {
      if (dot != 0) {
        que.push(tuple<int, pair<int, int>, int>(
            min(sharp, dot), pair<int, int>(sharp, dot), j));
        dot = 0;
        sharp = 0;
        j++;
      }
      sharp++;
    }
    if (S[i] == '.') {
      dot++;
    }
  }
  que.push(tuple<int, pair<int, int>, int>(min(sharp, dot),
                                           pair<int, int>(sharp, dot), j));
  while (!que.empty()) {
    tuple<int, pair<int, int>, int> p = que.top();
    que.pop();
    if (done[get<2>(p)]) {
      ans += get<1>(p).second;
    } else {
      ans += get<0>(p);
    }
  }
  cout << ans << endl;
  return 0;
}
