func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = (long long)1e9;   long long max(long long a, long long b, long long c) {     return max(a, max(b, c));   }   long long n;   long long house[200011];   long long mn[200011][2][2];   long long mx[200011][2][2];   long long f(long long i, long long j, long long k) {     if (i == -1) return 0;     if (mn[i][j][k] != -1) return mn[i][j][k];     long long res = INF;     if (house[i] == 0)       res = f(i - 1, 0, j);     else if (j + k == 0)       res = 1 + f(i - 1, 1, 0);     else if (j == 1)       res = f(i - 1, 0, 1);     else       res = f(i - 1, 0, 0);     return mn[i][j][k] = res;   }   long long g(long long i, long long j, long long k) {     if (i == -1) return 0;     if (mx[i][j][k] != -1) return mx[i][j][k];     long long res = 0;     if (house[i] == 0)       res = g(i - 1, 0, j);     else if (j + k == 2)       res = 1 + g(i - 1, 1, 1);     else if (j + k == 0) {       if (house[i] == 1)         res = 1 + max(g(i - 1, 1, 0), g(i - 1, 0, 1), g(i - 1, 0, 0));       else if (house[i] == 2)         res = 2 + max(g(i - 1, 1, 1), g(i - 1, 1, 0), g(i - 1, 0, 1));       else         res = 3 + g(i - 1, 1, 1);     } else if (j == 1) {       if (house[i] == 1)         res = 1 + max(g(i - 1, 1, 1), g(i - 1, 0, 1));       else         res = 2 + g(i - 1, 1, 1);     } else {       if (house[i] == 1)         res = 1 + max(g(i - 1, 0, 1), g(i - 1, 1, 0));       else         res = 2 + g(i - 1, 1, 1);     }     return mx[i][j][k] = res;   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     memset(mn, -1, sizeof mn);     memset(mx, -1, sizeof mx);     cin >> n;     for (long long i = 0; i < n; i++) {       long long x;       cin >> x;       house[--x]++;     }     cout << f(n - 1, 0, 0) <<     << g(n - 1, 0, 0);     return 0;   }   