func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> arr(n + 1, -1);     for (int i = 1; i <= n; i++) {       int temp;       cin >> temp;       arr[i] = temp;     }     int ans = 0;     vector<int> mini(n + 1, -1);     vector<int> maxi(n + 1, -1);     vector<int> equal(n + 1, -1);     equal[1] = 1;     mini[1] = 1;     maxi[1] = 1;     for (int i = 2; i <= n; i++) {       if (arr[i] != arr[i - 1])         equal[i] = 1;       else {         equal[i] = equal[i - 1] + 1;         mini[i] = mini[i - 1] + 1;         maxi[i] = maxi[i - 1] + 1;       }       if (arr[i] > arr[i - 1]) {         maxi[i] = max(mini[i - 1] + 1, equal[i - 1] + 1);         mini[i] = 1;       }       if (arr[i] < arr[i - 1]) {         mini[i] = max(maxi[i - 1] + 1, equal[i - 1] + 1);         maxi[i] = 1;       }       int temp = max(mini[i], max(maxi[i], equal[i]));       if (temp > ans) ans = temp;     }     cout << ans;     return 0;   }   