#include <stdio.h>
#include <stdlib.h>

void max_one(int arr, int length) {
    int count = 0, max = 0;

    for (int i = 0; i <= length; i++) {
        if (arr[i] == 1)  
            count++;  // count no. of consecutive 1's.
        else  
            count = 0;  // reset when 0 comes.

        if (count > max) {  
            max = count;  // store max value.
        }
    }
    printf("%d", max);
}

void main() {
    int arr[50], len;

    printf("Enter the length of array: ");
    scanf("%d", &len);

    printf("Enter the array: ");
    for (int i = 0; i < len; i++) {  // input
        scanf("%d", &arr[i]);
    }

    max_one(arr, len);
}