func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int add(int a, int b, int m = 1000000007) {     a += b;     if (a >= m) a -= m;     return a;   }   inline int mul(int a, int b, int m = 1000000007) {     return (int)(((long long)a * (long long)b) % m);   }   inline int norm(int x, int m = 1000000007) {     if (x >= m) x %= m;     if (x < 0) x += m;     return x;   }   inline int neg(int x, int m = 1000000007) {     x = -x;     return norm(x);   }   int c[501];   int dp[501][501];   int f(int i, int j) {     if (i == j) return 1;     if (i == j - 1) return 2 - (int)(c[i] == c[j]);     int &ans = dp[i][j];     if (ans != -1) return ans;     ans = 1000000007;     for (int k = i; k <= j - 1; ++k) {       ans = min(ans, f(i, k) + f(k + 1, j));     }     if (c[i] == c[j]) ans = min(ans, f(i + 1, j - 1));     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; ++i) cin >> c[i];     memset(dp, -1, sizeof(dp));     cout << f(1, n);     return 0;   }   