#include <bits/stdc++.h>
using namespace std;
int maxSubArraySum(int arr[], int size) {
int max_so_far = INT_MIN; // Initialize max_so_far to a very small value
int max_ending_here = 0; // Initialize max_ending_here to 0
for (int i = 0; i < size; i++) {
max_ending_here += arr[i]; // Add the current element to max_ending_here
if (max_so_far < max_ending_here) {
max_so_far = max_ending_here; // Update max_so_far if max_ending_here is greater
}
if (max_ending_here < 0) {
max_ending_here = 0; // Reset max_ending_here to 0 if it becomes negative
}
}
return max_so_far;
}
int main() {
int N; // Number of positive integers
cin >> N;
int arr[N];
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
int result = maxSubArraySum(arr, N);
cout << "Maximum number of contiguous subarrays with even sum: " << result << endl;
return 0;
}