import java.util.Scanner; public class Main { private static void printBitArray(boolean[] array, int startIndex) { for (int i = startIndex; i < array.length; i++) { System.out.print(array[i] ? 1 : 0); } System.out.println(); } private static void toBitArray(String s, boolean[] bitArray, int padding, int fullLength) { for (int i = 0; i < padding - 1; i++) { bitArray[i] = true; } for (int i = padding - 1; i < fullLength; i++) { bitArray[i] = s.charAt(i - padding + 1) == '1'; } } private static int calculateMinChanges(String input, int originalLength, int windowSize) { int minWeight = (windowSize + 1) / 2; int fullLength = originalLength + minWeight - 1; int changeCount = 0; int currentWeight = 0; boolean[] bits = new boolean[fullLength]; toBitArray(input, bits, minWeight, fullLength); for (int i = 0; i < windowSize; i++) { if (bits[i]) currentWeight++; } if (currentWeight < minWeight) { bits[windowSize - 1] = true; currentWeight++; changeCount++; } for (int i = 1; i <= fullLength - windowSize; i++) { if (bits[i - 1]) currentWeight--; if (bits[i + windowSize - 1]) currentWeight++; if (currentWeight < minWeight) { bits[i + windowSize - 1] = true; currentWeight++; changeCount++; } } return changeCount; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); String s = scanner.next(); scanner.close(); int result = calculateMinChanges(s, N, 3); System.out.println(result); } }