func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 505;   int dp[N][N];   int a[N];   int calc(int l, int r) {     if (dp[l][r] != -1) return dp[l][r];     if (l > r) {       return dp[l][r] = 1;     }     if (l == r) {       return dp[l][r] = 1;     }     dp[l][r] = N;     if (a[l] == a[r]) {       dp[l][r] = min(dp[l][r], calc(l + 1, r - 1));     }     for (int j = l; j < r; j++) {       dp[l][r] = min(dp[l][r], calc(l, j) + calc(j + 1, r));     }     return dp[l][r];   }   int main() {     for (int i = 0; i < N; i++)       for (int j = 0; j < N; j++) dp[i][j] = -1;     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     cout << calc(0, n - 1) << endl;   }   