#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <ctime>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <sstream>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const double pi = acos(-1.0);


int main() {
    freopen("handshakes.in", "r", stdin);
    freopen("handshakes.out", "w", stdout);

    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    	cin >> a[i];
    int ans = 0;
    for (int i = 0; i < n; i++) {
    	int cur = a[i];
    	for (int j = i + 1; j < n; j++)
    		cur += (a[j] > 0);

    	ans = max(ans, cur);
    }

    cout << ans << endl;

    return 0;
}