3
-1 1 -1
 4
45 -1 41 -1
 1
-1
 5
40 -1 44 46 48
 6
43 40 37 34 -1 -1
 7
-1 2 4 -1 4 1 5
 19
23 26 -1 -1 35 38 41 -1 -1 -1 53 -1 59 62 6 7 8 9 -1
 6
-1 2 6 -1 -1 6
 16
3 8 13 18 23 -1 -1 -1 43 48 53 45 -1 -1 -1 -1
 13
25 24 23 22 24 27 -1 33 -1 2 2 2 -1
 12
-1 17 -1 54 -1 64 -1 74 79 84 -1 94
 8
-1 12 14 16 18 20 -1 -1
 13
2 -1 3 1 3 1 -1 1 3 -1 -1 1 1
 5
-1 40 42 -1 46
 2
1000000000 -1
 14
-1 5 3 -1 -1 31 31 31 -1 31 -1 -1 4 7
 3
-1 1000000000 999999999
 7
32 33 34 -1 -1 37 38
 1
1000000000
 10
29 27 -1 23 42 -1 -1 45 -1 -1
 3
39 42 -1
 15
-1 28 -1 32 34 26 -1 26 -1 -1 26 26 26 -1 -1
 3
1000000000 999999999 1000000000
 17
-1 -1 -1 -1 64 68 72 -1 45 46 47 48 49 50 51 52 53
 3
-1 1 1000000000
 2
-1 1000000000
 3
999999999 -1 1000000000
 1
1
 2
1000000000 1000000000
 3
999999999 1000000000 -1
 7
11 8 5 -1 -1 -1 -1
 3
-1 1 2
 2
-1 21
 8
-1 -1 1 7 -1 9 5 2
 11
9 21 17 13 -1 -1 -1 -1 -1 -1 -1
 3
-1 1000000000 -1
 6
-1 6 1 -1 -1 -1
 1
65
 20
-1 32 37 -1 -1 -1 57 -1 -1 40 31 33 -1 -1 39 47 43 -1 35 32
 5
-1 1 7 -1 5
 18
21 19 -1 -1 -1 48 50 -1 54 -1 5 1 -1 -1 -1 37 36 35
 9
42 39 36 33 -1 -1 -1 34 39
 2
-1 -1

1
 1
 1
 1
 1
 3
 2
 2
 2
 3
 2
 1
 6
 1
 1
 3
 1
 1
 1
 2
 1
 2
 2
 2
 2
 1
 2
 1
 1
 1
 2
 2
 1
 3
 3
 1
 2
 1
 5
 2
 4
 2
 1

#include <bits/stdc++.h>
using namespace std;
int n, a[200005], A[200005], B[200005], dp[200005][2];
int func(int pos, int state) {
  if (pos == n) {
    if (state == 0) return 0;
    return 1;
  }
  if (dp[pos][state] != -1) {
    return dp[pos][state];
  }
  int ans;
  if (a[pos] == -1) {
    int x, y;
    y = 1 + func(A[pos], 1);
    int i = A[pos];
    if (A[i] == -1) {
      x = 1;
    } else {
      x = 1 + func(A[i], 1);
      long long int diff, cdiff, cd;
      diff = A[i] - i;
      cdiff = a[A[i]] - a[i];
      if (cdiff % diff == 0) {
        cd = cdiff / diff;
        if (a[A[pos]] - ((A[pos] - pos) * cd) > 0) {
          x = min(x, 1 + func(A[i], 0));
        }
      }
    }
    ans = min(x, y);
    dp[pos][state] = ans;
    return ans;
  }
  if (state == 1) {
    if (A[pos] == -1) return 1;
    int diff, cdiff, x, y;
    diff = A[pos] - pos;
    cdiff = a[A[pos]] - a[pos];
    if (cdiff % diff) {
      ans = 1 + func(A[pos], 1);
    } else {
      x = 1 + func(A[pos], 0);
      y = 1 + func(A[pos], 1);
      ans = min(x, y);
    }
  } else {
    long long int cdiff, diff, cd1, cd2;
    int x, y;
    diff = pos - B[pos];
    cdiff = a[pos] - a[B[pos]];
    cd1 = cdiff / diff;
    diff = A[pos] - pos;
    cdiff = a[A[pos]] - a[pos];
    cd2 = cdiff / diff;
    if (A[pos] == -1) {
      if (cd1 >= 0) {
        ans = 0;
      } else if (a[pos] + (n - pos) * cd1 <= 0) {
        ans = 1;
      } else {
        ans = 0;
      }
    } else {
      if (cdiff % diff == 0 && cd2 == cd1) {
        x = func(A[pos], 0);
        y = func(A[pos], 1);
        ans = min(x, y);
      } else {
        if (cd1 >= 0) {
          ans = func(A[pos], 1);
        } else if (a[pos] + ((A[pos] - pos - 1) * cd1) <= 0) {
          int next = a[pos] / cd1;
          if (next < 0) next *= (-1);
          if (a[pos] % cd1) next++;
          ans = func(pos + next, 1);
        } else {
          ans = func(A[pos], 1);
        }
      }
    }
  }
  dp[pos][state] = ans;
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int last = -1;
  for (int i = 1; i <= n; i++) {
    B[i] = last;
    if (a[i] != -1) {
      last = i;
    }
  }
  last = -1;
  for (int i = n; i >= 1; i--) {
    A[i] = last;
    if (a[i] != -1) {
      last = i;
    }
  }
  memset(dp, -1, sizeof(dp));
  int ans;
  if (a[1] != -1) {
    ans = func(1, 1);
  } else if (A[1] == -1) {
    ans = 1;
  } else {
    int x, y;
    y = 1 + func(A[1], 1);
    if (A[A[1]] == -1) {
      x = 1;
    } else {
      x = 1 + func(A[A[1]], 1);
      long long int diff, cdiff, cd;
      diff = A[A[1]] - A[1];
      cdiff = a[A[A[1]]] - a[A[1]];
      if (cdiff % diff == 0) {
        cd = cdiff / diff;
        if (a[A[1]] - ((A[1] - 1) * cd) > 0) {
          x = min(x, 1 + func(A[A[1]], 0));
        }
      }
    }
    ans = min(x, y);
  }
  printf("%d\n", ans);
}
