func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, a[1111], f[1111];   int main() {     cin >> n;     for (int i = 0; i < n; ++i) cin >> a[i];     for (int day = 1000; day >= 1; --day) {       for (int i = 0; i < n; ++i) f[i] = 0;       f[0] = (day <= a[0]);       for (int i = 1; i < n; ++i) {         if (day > a[i]) continue;         f[i] |= f[i - 1];         if (i > 1) f[i] |= f[i - 2];       }       if (f[n - 1]) {         cout << day << endl;         return 0;       }     }   }   