Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	ma, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	args := strings.Split(sc.Text(), " ")

	value := []int{}
	for _, v := range args {
		a, _ := strconv.Atoi(v)
		value = append(value, a)

	}
	ans(ma, value)

}

func ans(n int, value []int) {

	max := 0
	cnt := 0

	for i := 0; i < n; i++ {

		if value[i] == 1 {
			cnt++
		} else {
			if cnt > max {
				max = cnt
			}
			cnt = 0
		}
	}

	if cnt > max {
		max = cnt
	}

	fmt.Printf("%d\n", max+1)
}

C++: /*宣言*/
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string.h>
#include<string>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
int main()
{
	int n, a[101], ans = 0,cnt=0;
	cin >> n;
	rep(i, n)
	{
		cin >> a[i];
		if (a[i] != 0)
			cnt++;
		else
			cnt = 0;
		if (ans < cnt)
		{
			ans = cnt;
		}
	}
	cout << ans+1 << endl;
	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        v.push_back(a);
    }
    v.push_back(0);

    bool run = false;
    int count = 0;
    int max_ = 0;
    for (int i = 0; i < v.size(); ++i) {
        if (v[i] == 1) {
            if (run) {
                count += 1;
            }
            else {
                run = true;
                count = 1;
            }
        }
        else {
            if (run) {
                max_ = max(max_, count);
                run = false;
            }
        }
    }
    cout << (max_ + 1) << endl;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
    int N,i,j;
    int counter=0,ans=0;
    int a[N];
    cin>>N;
    for(i=0;i<N;i++)
    {
        cin>>a[i];
    }
    for(j=0;j<N;j++)
    {
        counter++;
        if(a[j]==0)
        {
            if(ans<counter)
            {
                ans=counter;
            }
            counter=0;
        }
        if(j==N-1&&a[j]==1&&ans<counter+1)
        {
            ans=counter+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

C++: #include<stdio.h>
int main(void)
{
        int KAZU;
	int MASU[100];
	int RENZOKU = 0;
	int MAX = 0;
	
	scanf("%d",&KAZU);
	
	int a;
	
	for(a=0;a<KAZU;a++)
	{
		scanf("%d",&MASU[a]);
		
		if(MASU[a] == 1)
		{
			RENZOKU++;
		}
		else
		{
			if(MAX<RENZOKU)
			
				MAX = RENZOKU;
				RENZOKU = 0;
			
		}
	}
	if(MAX<RENZOKU)
	{
		MAX=RENZOKU;
	}
	
	printf("%d\n",MAX+1);
        return 0;
}

C++: #include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n;
	int i;
	int counter=0;
	int max=0;
	
	int a[101];
	cin>>n;
	
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}	
		
	for(i=0;i<n;i++)
	{
		if(a[i]==1)
			counter++;
		else
		{
			if(max<counter)
				max=counter;
			counter=0;
		}
	}
	if(max<counter)
		max=counter;
		
		cout<<max+1;
}

C++: #include <stdio.h>
int main(void){
    int n;
    char a[101];
    
    scanf("%d", &n);
    
    int i;
    for(i=1;i<=n;i++)
    {
        scanf("%d", &a[i]);
    }
    a[i]=0;
    
    int c=0;
    int c_max=0;
    for(i=1;i<=n+1;i++)
    {
        if(a[i]==1)
        c++;
        else if(c>0)
        {
            if(c>c_max)
            c_max=c;
            c=0;
        }
    }
    return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
    int n;
    cin >> n;
    int value, count = 1, max = 1;
    for(int i = 0; i < n; i++) {
        cin >> value;
        if(value == 1) {
            count++;
        } else if (value == 0) {
            if(count > max) {
                max = count;
            }
            count = 1;
        }
    }
    if (count > max) {
        max = count;
    }
    cout << max << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int long long

int n, a[1000], ans;

signed main()
{
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i > 0){
            if(a[i] == 1){
                a[i] = a[i - 1] + 1;
            }
        }
        ans = max(ans, a[i]);
    }
    cout << ans + 1 << endl;



    return 0;
}

C++: #include<iostream>;
#include<algorithm>;
using namespace std;

int main()
{
	//2.すごろく	
	int n;
	cin >> n;
	int A, _A = 1;
	int k = 0;
	int count[100];
	count[k] = 1;
	for (int i = 0; i < n; i++)
	{
		cin >> A;
		if (A == 1)
		{
			if (A == _A)
			{
				count[k]++;
			}
			else
			{
				k++;
				count[k] = 2;
			}
		}
		_A = A;
	}
	sort(count, count + k);
	cout << count[k] << endl;

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
	int N;
	int count = 0, ans = 1;
	int A[102];
	
	cin >> N;
	for(int i = 1; i <= N; i++){
	    cin >> A[i];
	}
	A[N+1] = 0;

    for(int i = 1; i <= N+1; i++){
        if(A[i] == 0){
            ans = max(ans, i - count);
            count = i;
        }
    }

	cout << ans << endl;
}

C++: #include<iostream>//aoj642
using namespace std;
int main(void)
{
	int i,n,a,x=0,y=0;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a;
		if(a==0) x=0;
		if(a==1) x=x+1;
		if(y<x) y=x;
	}
	y=y+1;
	cout<<y<<endl;
	return 0;
}

C++: #include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	int n; cin >> n;
	
	int ma = 0, c = 0;
	for(int i = 0; i < n; i++) {
		int a; cin >> a;
		
		c = (c + 1) * a;
		ma = std::max(ma, c);
	}
	
	cout << ma + 1 << endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
	int i, j, N, A[110], s = 0, a = 0;
	cin>>N;
	for(i = 1; i <= N; i++){
		cin>>A[i];
	}
	
	for(i = 1; i <= N; i++){
		if(A[i] == 1){
			s++;
		} else {
			if(s > a)a = s;
			s = 0;
		}
	}
	if(a == 0) a = s;
	cout<<a + 1<<endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	int lp = 0;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (int j = i; j < n; j++) {
			if (a[j] == 1) cnt++;
			else break;
		}
		lp = max(lp, cnt + 1);
	}
	cout << lp << endl;
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;

int n, a[101];
bool ok[101];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= n + 1; j++) ok[j] = false;
    ok[0] = true;
    for (int k = 1; k <= n + 1; k++) {
      if (a[k] == 1) continue;
      for (int j = i; j >= 1; j--) {
        if (ok[k - j]) {
          ok[k] = true;
          break;
        }
      }
    }
    if (ok[n + 1]) {
      printf("%d\n", i);
      break;
    }
  }
}

C++: #include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main() {
    int N;
    cin >> N;
    int maxLength = 0;
    int length = 0;

    rep(i, N) {
        int A;
        cin >> A;
        if (A) {
            length++;
        } else {
            length = 0; 
        }
        maxLength = max(maxLength, length);
    }
    cout << (maxLength + 1) << endl;
}