func_code_string: #include <bits/stdc++.h>   using namespace std;   long long add(long long x, long long y) {     x += y;     while (x >= 998244353) x -= 998244353;     while (x < 0) x += 998244353;     return x;   }   long long mul(long long x, long long y) { return (x * 1ll * y) % 998244353; }   long long binpow(long long x, long long y) {     long long z = 1;     while (y > 0) {       if (y % 2 == 1) z = mul(z, x);       x = mul(x, x);       y /= 2;     }     return z;   }   long long inv(long long x) { return binpow(x, 998244353 - 2); }   long long divide(long long x, long long y) { return mul(x, inv(y)); }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, k;     cin >> n >> k;     vector<long long> a(k);     for (long long i = 0; i < (long long)k; ++i) cin >> a[i];     vector<long long> last(n + 1, -1), fst(n + 1, k);     for (long long i = 1; i <= k; i++) {       last[a[i - 1]] = i;     }     for (long long i = k; i >= 1; i--) {       fst[a[i - 1]] = i;     }     long long ans = 0;     for (long long i = 1; i <= n; i++) {       for (long long j = max(1ll, i - 1); j <= min(i + 1, n); j++) {         if (j == i) {           if (last[i] == -1) ans += 1;         } else           ans += (last[i] <= fst[j]);       }     }     cout << ans << endl;     return 0;   }   