#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n], x = 0;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] == 1) {         x++;       }     }     if (x == n) {       cout << n - 1 <<   n ;     } else {       int p = 0, m = 0;       for (int i = 0; i < n; i++) {         m = 0;         for (int j = i; j < n; j++) {           if (a[j] == 0) {             m++;           } else {             m--;           }           p = max(m, p);         }       }       cout << x + p <<   n ;     }   }   