#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  int n;
  scanf("%d", &n);
  char *B = (char *)malloc(10240 * sizeof(char));
  scanf("%s", B);
  int len = strlen(B);
  int count = 0;
  int i = 0;
  while (i <= n - 3) {
    if (B[i] == '0' && B[i + 1] == '1' && B[i + 2] == '0') {
      count++;
      i = i + 3;
    } else {
      i++;
    }
  }
  printf("%d", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    $0x2800,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jg     121a <main+0xda>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jne    120c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    120c <main+0xcc>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jne    120c <main+0xcc>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x1c(%rbp)
jmp    1215 <main+0xd5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <main+0x5b>
mov    -0x18(%rbp),%esi
lea    0xddc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
xor    %ebp,%ebp
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    $0x2800,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe97(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
jge    119e <main+0x5e>
lea    0xe72(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0xfffffffd,%eax
xor    %ecx,%ecx
xor    %ebp,%ebp
jmp    11b6 <main+0x76>
nopw   0x0(%rax,%rax,1)
mov    %edx,%ecx
cmp    %eax,%edx
jg     1187 <main+0x47>
movslq %ecx,%rsi
lea    0x1(%rsi),%rdx
cmpb   $0x30,(%rbx,%rsi,1)
jne    11b0 <main+0x70>
cmpb   $0x31,(%rbx,%rdx,1)
jne    11b0 <main+0x70>
cmpb   $0x30,0x2(%rsi,%rbx,1)
jne    11b0 <main+0x70>
add    $0x1,%ebp
add    $0x3,%ecx
mov    %ecx,%edx
jmp    11b0 <main+0x70>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i64 @malloc(i32 10240)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %14
14: ; preds = %53, %0
%15 = load i32, i32* %6
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 3
%18 = icmp sle i32 %15, %17
br i1 %18, label %19, label %54
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 48
br i1 %26, label %27, label %50
27: ; preds = %19
%28 = load i8*, i8** %3
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 49
br i1 %35, label %36, label %50
36: ; preds = %27
%37 = load i8*, i8** %3
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 2
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 48
br i1 %44, label %45, label %50
45: ; preds = %36
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 3
store i32 %49, i32* %6
br label %53
50: ; preds = %36, %27, %19
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %53
53: ; preds = %50, %45
br label %14
54: ; preds = %14
%55 = load i32, i32* %5
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i64 @malloc(i32 10240)
%5 = inttoptr i64 %4 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @strlen(i8* %5)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -3
%10 = icmp slt i32 %8, 3
br i1 %10, label %37, label %11
11: ; preds = %0, %33
%12 = phi i32 [ %35, %33 ], [ 0, %0 ]
%13 = phi i32 [ %34, %33 ], [ 0, %0 ]
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds i8, i8* %5, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 48
%18 = add nsw i32 %12, 1
br i1 %17, label %19, label %33
19: ; preds = %11
%20 = sext i32 %18 to i64
%21 = getelementptr inbounds i8, i8* %5, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 49
br i1 %23, label %24, label %33
24: ; preds = %19
%25 = add nsw i32 %12, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %5, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 48
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = add nsw i32 %13, 1
%32 = add nsw i32 %12, 3
br label %33
33: ; preds = %11, %19, %24, %30
%34 = phi i32 [ %31, %30 ], [ %13, %24 ], [ %13, %19 ], [ %13, %11 ]
%35 = phi i32 [ %32, %30 ], [ %18, %24 ], [ %18, %19 ], [ %18, %11 ]
%36 = icmp sgt i32 %35, %9
br i1 %36, label %37, label %11
37: ; preds = %33, %0
%38 = phi i32 [ 0, %0 ], [ %34, %33 ]
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %38)
ret i32 0
}