#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <typename T>
void putv(vector<T>& V) {
  for (auto x : V) cout << x << " ";
  cout << endl;
}
long long pown(long long fi, long long se) {
  long long ans = 1;
  for (int(i) = 0; (i) < (se); (i)++) {
    ans *= fi;
  }
  return ans;
}
template <class T>
vector<T> getv(long long n) {
  vector<T> Vector_temp;
  for (int(i) = 0; (i) < (n); (i)++) {
    T input;
    cin >> input;
    Vector_temp.emplace_back(input);
  }
  return Vector_temp;
}
long long gcd(long long c, long long b) {
  while (1) {
    if (c % b != 0) {
      long long tmp = b;
      b = c % b;
      c = tmp;
    } else {
      return b;
    }
  }
}
int main() {
  long long n;
  cin >> n;
  string a;
  cin >> a;
  long long ans = 0;
  long long tmp = 0;
  for (int i = a.size() - 1; i >= 0; i--) {
    if (a[i] == '.')
      tmp++;
    else {
      ans += tmp;
      tmp = 0;
    }
  }
  tmp = 0;
  long long ans2 = 0;
  for (int(i) = 0; (i) < (a.size()); (i)++) {
    if (a[i] == '#')
      tmp++;
    else {
      ans2 += tmp;
      tmp = 0;
    }
  }
  cout << min(ans, ans2) << endl;
  return 0;
}
