func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     int arr[n + 10];     for (int i = 1; i <= n; i++) scanf( %d , &arr[i]);     int start, end;     start = 1;     int pos_1 = -1, pos_2 = -1;     int cnt = 0;     int t = 0;     for (int i = 1; i <= n;) {       pos_1 = -1;       pos_2 = -1;       start = i;       for (int j = start; j <= n; j++) {         if (arr[j] != -1) {           pos_1 = j;           break;         }       }       if (pos_1 != -1) {         for (int j = pos_1 + 1; j <= n; j++)           if (arr[j] != -1) {             pos_2 = j;             break;           }         if (pos_2 == -1) {           cnt++;           break;         }         t++;         if (arr[pos_1] == arr[pos_2]) {           start = pos_2 + 1;           for (int j = pos_2 + 1; j <= n; j++)             if (arr[j] == -1 || arr[j] == arr[pos_1])               start = j + 1;             else {               start = j;               break;             }           cnt++;         } else {           long long val = (arr[pos_2] - arr[pos_1]);           int d = pos_2 - pos_1;           if (val % d == 0) {             int yes = val / d;             val = arr[pos_1];             yes *= (-1);             for (int j = pos_1 - 1; j >= start; j--) {               val += yes;               if (val <= 0) {                 cnt++;                 start = pos_2;                 goto End;               }               if (arr[j] != -1 && arr[j] != val) {                 cnt++;                 start = pos_2;                 goto End;               }             }             val = arr[pos_2];             yes *= (-1);             start = -1;             for (int j = pos_2 + 1; j <= n; j++) {               val += yes;               if (val <= 0) {                 start = j;                 break;               }               if (arr[j] != -1 && arr[j] != val) {                 start = j;                 break;               }             }             if (start == -1) start = n + 1;             cnt++;           } else {             cnt += 1;             start = pos_2;           }         }       } else {         cnt++;         break;       }     End:;       i = start;     }     cout << cnt << endl;     return 0;   }   