func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INFINITE = (int)(0xffffffff >> 2);   int n;   int gs[600];   int dp[600][600];   int run(int l, int r) {     if (l > r) return 0;     if (l == r) return 1;     if (dp[l][r] != INFINITE) {       return dp[l][r];     }     dp[l][r] = min(dp[l][r], run(l + 1, r) + 1);     for (int k = l + 2; k <= r; k++) {       if (gs[l] == gs[k]) {         dp[l][r] = min(dp[l][r], run(l + 1, k - 1) + run(k + 1, r));       }     }     if (gs[l] == gs[l + 1]) {       dp[l][r] = min(dp[l][r], run(l + 2, r) + 1);       return dp[l][r];     }     return dp[l][r];   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> gs[i];     for (int i = 0; i < 600; i++) {       int *row = dp[i];       for (int j = 0; j < 600; j++) {         row[j] = INFINITE;       }     }     cout << run(1, n) << endl;     return 0;   }   