func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxn = 2 * 100000 + 6;   int n, root;   int a[mxn];   int c[mxn];   int s[mxn];   int base;   int ans = 0x3f3f3f3f;   int main() {     cin >> n >> root;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       if (i == root && a[i] != 0) {         ++base;         a[i] = 0;       }       ++c[a[i]];     }     partial_sum(c, c + n, s);     int c0 = 0;     for (int i = 0; i < n; ++i) {       c0 += (c[i] == 0);       int mov = c[0] - 1 + n - s[i];       int sum = max(mov, c0);       if (i || n == 1) {         ans = min(ans, sum);       }     }     cout << ans + base << endl;     return 0;   }   