#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 */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int max_streak = 0;
  int curr_streak = 0;
  while (n) {
    if (n % 2) {
      curr_streak++;
      if (curr_streak > max_streak) {
        max_streak = curr_streak;
      }
    } else {
      curr_streak = 0;
    }
    n >>= 1;
  }
  printf("%d\n", max_streak);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11a0 <main+0x80>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     118b <main+0x6b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1186 <main+0x66>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <main+0x72>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114d <main+0x2d>
mov    -0xc(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1170 <main+0x50>
xor    %ecx,%ecx
xor    %esi,%esi
xchg   %ax,%ax
mov    %eax,%r8d
mov    %esi,%r9d
mov    %eax,%edx
and    $0x1,%edx
mov    %edx,%edi
neg    %edi
cmp    %esi,%ecx
lea    0x1(%rcx),%ecx
mov    %ecx,%esi
cmovl  %r9d,%esi
test   %edx,%edx
cmove  %r9d,%esi
and    %edi,%ecx
sar    %eax
cmp    $0x1,%r8d
ja     1140 <main+0x20>
mov    %eax,0x4(%rsp)
jmp    1172 <main+0x52>
xor    %esi,%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %23, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i32, i32* %2
%11 = srem i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = load i32, i32* %4
store i32 %20, i32* %3
br label %21
21: ; preds = %19, %13
br label %23
22: ; preds = %9
store i32 0, i32* %4
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %2
%25 = ashr i32 %24, 1
store i32 %25, i32* %2
br label %6
26: ; preds = %6
%27 = load i32, i32* %3
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %16, %6 ], [ 0, %0 ]
%8 = phi i32 [ %15, %6 ], [ 0, %0 ]
%9 = phi i32 [ %17, %6 ], [ %4, %0 ]
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
%12 = add nsw i32 %7, 1
%13 = icmp slt i32 %7, %8
%14 = select i1 %11, i1 true, i1 %13
%15 = select i1 %14, i32 %8, i32 %12
%16 = select i1 %11, i32 0, i32 %12
%17 = ashr i32 %9, 1
%18 = icmp ult i32 %9, 2
br i1 %18, label %19, label %6
19: ; preds = %6
store i32 %17, i32* %1
br label %20
20: ; preds = %19, %0
%21 = phi i32 [ %15, %19 ], [ 0, %0 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}