import java.util.ArrayDeque; import java.util.Arrays; import java.util.Scanner; class Main { void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String S = sc.next(); boolean[] a = new boolean[S.length()]; for (int i = 0; i < S.length(); ++i) { a[i] = S.charAt(i) == '.'; } int ans = solve(Arrays.copyOf(a, a.length), n); { int s = 0; int t = a.length - 1; while (s < t) { boolean tmp = a[s]; a[s] = a[t]; a[t] = tmp; ++s; --t; } n = S.length() - n + 1; } ans = Math.min(ans, solve(a, n)); System.out.println(ans); } ArrayDeque dq = new ArrayDeque<>(); int solve(boolean[] a, int n) { int ret = Integer.MAX_VALUE / 3; int t = a.length - 1; int s = 0; while (a[t]) --t; while (a[s]) ++s; if (t < n - 1) return ret; int cur = 0; for (int i = 0; i < a.length; ++i) { //s->t if (s < i && i <= t) { a[i] = !a[i]; ++cur; } if ((s <= i && i < n - 1) || (n - 1 < i && i <= s)) { a[i] = !a[i]; ++cur; } } for (int i = 0; i < a.length; ++i) { if (!a[i]) dq.addLast(i); } while (!dq.isEmpty()) { if (dq.size() >= 2) { int u = dq.pollFirst(); int v = dq.pollFirst(); cur += (v - u) * 2; } else { int u = dq.pollFirst(); cur += Math.abs((t - 1) - u) * 2 + 1; } } ret = Math.min(ret, cur); return ret; } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } public static void main(String[] args) { new Main().run(); } }