#include <bits/stdc++.h>
using namespace std;
char arr[2000010];
int num(int a, int N) {
  int b = 0, c = 0;
  for (int i = a; i >= 0; --i) {
    if (arr[i] == '#')
      ++b;
    else
      break;
  }
  for (int i = a + 1; i < N; ++i) {
    if (arr[i] == '.')
      ++c;
    else
      break;
  }
  if (b < c) {
    for (int i = a; i >= 0; --i) {
      if (arr[i] == '#')
        arr[i] = '.';
      else
        break;
    }
  } else {
    for (int i = a + 1; i < N; ++i) {
      if (arr[i] == '.')
        arr[i] = '#';
      else
        break;
    }
  }
  return min(b, c);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> arr[i];
  int cost = 0;
  for (int i = 0; i < N - 1; ++i) {
    if (arr[i] == '#' && arr[i + 1] == '.') {
      cost += num(i, N);
    }
  }
  cout << cost << endl;
}
