arr = [int(x) for x in input().split()]
max = 0;
i = 0;
li_max = []

do{
    if (arr[i] == 1)
    {
        if (max == 0):
            max += 1;
            i++;
		if (arr[i] == 1 and arr[i + 1] == 1):
		    max += 1;
		    i++;
		else if (arr[i] == 1 and arr[i + 1] != 1):
		    li_max.append(max)
        if(max>=1 and arr[i+1]==1)
            max+=1
            i++
        else(max>=1 and arr[i+1]!=1)
            max += 1
            i++
            li_max.append(max)
     }
     else{
        i++;
     }
}while(i<arr.length())
print(max(li_max)