#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long int x, c;
};
long long int mod(long long int a, long long int mod) {
  long long int res = a % mod;
  if (res < 0) res = res + mod;
  return res;
}
long long int modpow(long long int a, long long int n, long long int mod) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long int modinv(long long int a, long long int mod) {
  return modpow(a, mod - 2, mod);
}
long long int gcd(long long int a, long long int b) {
  long long int r = a % b;
  if (r == 0)
    return b;
  else
    return gcd(b, a % b);
}
bool is_prime(long long int n) {
  long long int i = 2;
  if (n == 1) return false;
  if (n == 2) return true;
  bool res = true;
  while (i * i < n) {
    if (n % i == 0) {
      res = false;
    }
    i = i + 1;
  }
  if (n % i == 0) res = false;
  return res;
}
struct UnionFind {
  long long int N;
  vector<long long int> p;
  vector<long long int> cnt;
  UnionFind(long long int n) {
    N = n;
    p = vector<long long int>(N);
    cnt = vector<long long int>(N, 0);
    for (long long int i = 0; i < (N); i++) {
      p[i] = i;
      cnt[i] = 1;
    }
  }
  void con(long long int a, long long int b) {
    pair<long long int, long long int> at = root(a);
    pair<long long int, long long int> bt = root(b);
    if (at.second != bt.second) {
      if (at.first > bt.first) {
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second] += cnt[at.second];
      p[a] = bt.second;
    }
  }
  pair<long long int, long long int> root(long long int a) {
    long long int atmp = a;
    long long int c = 0;
    while (atmp != p[atmp]) {
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }
  bool is_con(long long int a, long long int b) {
    pair<long long int, long long int> at = root(a);
    pair<long long int, long long int> bt = root(b);
    return at.second == bt.second;
  }
};
struct dijkstra {
  long long int N;
  vector<long long int> d;
  vector<vector<edge>> e;
  dijkstra(long long int n) {
    N = n;
    e = vector<vector<edge>>(N);
  }
  void add_edge(long long int from, long long int to, long long int cost) {
    e[from].push_back({to, cost});
  }
  void run(long long int start) {
    priority_queue<pair<long long int, long long int>,
                   vector<pair<long long int, long long int>>,
                   greater<pair<long long int, long long int>>>
        que;
    que.push({0, start});
    d = vector<long long int>(N, 1e18);
    d[start] = 0;
    while (!que.empty()) {
      pair<long long int, long long int> q = que.top();
      que.pop();
      long long int dc = q.first;
      long long int x = q.second;
      if (dc > d[x]) {
        continue;
      } else {
        for (auto ip : e[x]) {
          if (d[ip.x] <= d[x] + ip.c) {
            continue;
          } else {
            d[ip.x] = d[x] + ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }
};
int main() {
  long long int N;
  string S;
  cin >> N >> S;
  long long int blk = 0;
  long long int iniblk = N;
  long long int lstwht = 0;
  for (long long int i = 0; i < (N); i++) {
    if (S[i] == '#') {
      blk++;
      iniblk = min(i, iniblk);
    } else {
      lstwht = i;
    }
  }
  long long int wht = N - blk;
  cout << min(N - iniblk - blk, blk - N - 1 - lstwht) << endl;
  return 0;
}
