func_code_string: #include <bits/stdc++.h>   using namespace std;   string ANSWER[2] = { NO n ,  YES n };   int v[2009], s1[2009], s2[2009];   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &v[i]);       s1[i] = s1[i - 1] + (v[i] == 1);       s2[i] = s2[i - 1] + (v[i] == 2);     }     int ans = 0;     for (int i = 1; i <= n; i++) {       int a = 0, b = 0;       for (int j = i; j <= n; j++) {         if (v[j] == 1) b++;         if (v[j] == 2) a++;         if (a > b) b = a;         ans = max(ans, s1[i - 1] + b + s2[n] - s2[j]);       }     }     printf( %d n , ans);     return 0;   }   