func_code_string: #include <bits/stdc++.h>   using namespace std;   int r[100005], t, n, m, ans = 0;   vector<int> id[100005];   set<int> v;   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d , &t);       v.insert(t);       id[t].push_back(i);       r[t] = max(r[t], i);     }     for (auto it : v) {       int sum = 0;       for (int i = 0; i < id[it].size() && sum < 2; i++) {         t = 0;         if (id[it][i] < r[it - 1]) t++;         if (id[it][i] < r[it + 1]) t++;         sum = max(sum, t);       }       ans += sum;     }     printf( %d n , n * 3 - 2 - ans - v.size());     return 0;   }   