#include<bits/stdc++.h>
using namespace std;
int main()
{
int t,a,count=0,temp=0;
cin>>t;
while(t--)
{
cin>>a;
if(a)
{
temp++;
}
else
{
if(count<temp)
{
count=temp;
}
temp=0;
}
}
if(count<temp)
count=temp;
cout<<count;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKIAppbnQgbWFpbigpCnsKCWludCB0LGEsY291bnQ9MCx0ZW1wPTA7CgljaW4+PnQ7Cgl3aGlsZSh0LS0pCgl7CgkJY2luPj5hOwoJCWlmKGEpCgkJewoJCQl0ZW1wKys7CgkJfQoJCWVsc2UKCQl7CgkJCWlmKGNvdW50PHRlbXApCgkJCXsKCQkJCWNvdW50PXRlbXA7CgkJCQoJCQl9CgkJCXRlbXA9MDsKCQl9Cgl9CglpZihjb3VudDx0ZW1wKQoJCWNvdW50PXRlbXA7Cgljb3V0PDxjb3VudDsKCXJldHVybiAwOwp9IA==