func_code_string: #include <bits/stdc++.h>   using namespace std;   int dp[500][500] = {0}, arr[500], n;   int check(int i, int j) {     if (dp[i][j] != 0) return dp[i][j];     if (i > j) return 0;     if (i == j) {       dp[i][j] = 1;       return 1;     }     int a = 1 + check(i + 1, j);     int m = 1e9, it;     for (it = i + 2; it <= j; it++) {       if (arr[i] == arr[it]) {         if (m > check(i + 1, it - 1) + check(it + 1, j)) {           m = check(i + 1, it - 1) + check(it + 1, j);         }       }     }     int c = 1e9;     if (arr[i] == arr[i + 1]) c = 1 + check(i + 2, j);     dp[i][j] = min(min(c, a), m);     return dp[i][j];   }   int main() {     cin >> n;     int i, j, k, l;     for (i = 0; i < n; i++) {       cin >> arr[i];     }     check(0, n - 1);     cout << dp[0][n - 1] << endl;     return 0;   }   