func_code_string: #include <bits/stdc++.h>   using namespace std;   int read() {     char ch = getchar();     int x, f = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     x = ch -  0 ;     while (1) {       ch = getchar();       if (ch <  0  || ch >  9 ) break;       x = x * 10 + ch -  0 ;     }     return x * f;   }   const int maxn = 510;   const int inf = 0x7fffffff;   int n, a[maxn], dp[maxn][maxn];   int main() {     n = read();     for (int i = 0; i < n; i++) a[i] = read();     for (int i = 1; i <= n; i++) {       for (int j = 0, k = i - 1; k < n; j++, k++) {         if (i == 1) {           dp[j][k] = 1;           continue;         }         dp[j][k] = dp[j + 1][k] + 1;         for (int p = j + 2; p <= k; p++)           if (a[p] == a[j])             dp[j][k] = min(dp[j][k], dp[j + 1][p - 1] + dp[p + 1][k]);         if (a[j] == a[j + 1]) dp[j][k] = min(dp[j][k], dp[j + 2][k] + 1);       }     }     printf( %d n , dp[0][n - 1]);     return 0;   }   