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); } int solve(boolean[] b, int n) { int ret = Integer.MAX_VALUE / 3; for (int j = 0; j < b.length - 1; ++j) { int cur = 0; boolean[] a = Arrays.copyOf(b, b.length); for (int k = j; k < b.length - 1; ++k) { a[k] = !a[k]; ++cur; } int t = a.length - 1; int s = 0; while (a[t]) --t; while (a[s]) ++s; for (int i = n - 2; i >= s; --i) { a[i] = !a[i]; ++cur; } for (int i = s + 1; i <= t; ++i) { a[i] = !a[i]; ++cur; } ArrayDeque dq = new ArrayDeque<>(); for (int i = s; i <= t; ++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 { cur = Integer.MAX_VALUE / 3; break; } } 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(); } }