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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class D {

    public static int solve(String[] as) {
        int idx = 0;
        int[] begin = new int[as.length / 2 + 2];
        int[] end = new int[begin.length];
        int[] inc = new int[begin.length];
        int[] parsed = new int[as.length];
        inc[idx] = 1;
        begin[idx] = -1;
        end[idx] = -1;
        idx++;
        begin[idx] = -1;
        inc[idx] = Integer.MAX_VALUE;
        for (int i = 0; i < as.length; ++i) {
            parsed[i] = Integer.parseInt(as[i]);
            if (parsed[i] == -1) {
                if (begin[idx] == -1) {
                    // continue
                } else {
                    if (inc[idx] != Integer.MAX_VALUE) {
                        assert parsed[i - 1] != -1;
                        parsed[i] = parsed[i - 1] + inc[idx];
                        if (parsed[i] < 1) {
                            parsed[i] = -1;
                            end[idx] = i - 1;
                            idx += 1;
                            begin[idx] = -1;
                            inc[idx] = Integer.MAX_VALUE;
                            // all is good
                        } else {
                            // continue
                        }
                    } else {
                        // continue
                        // 00000000000010000000 cant do anything here
                    }
                }
            } else {
                if (begin[idx] == -1) {
                    // it is not -1 but seq hasn't began so we have to start
                    begin[idx] = i;
                } else {
                    // it is not -1 and seq already began
                    if (inc[idx] != Integer.MAX_VALUE) {
                        if (parsed[i - 1] + inc[idx] == parsed[i]) {
                            // continue
                        } else {
                            end[idx] = i - 1;
                            idx += 1;
                            begin[idx] = i;
                            inc[idx] = Integer.MAX_VALUE;
                            // go
                        }
                    } else {
                        // the inc for this seq hasn't been decided
                        // also check if the -1 buffer can hold the inc
                        if ((parsed[i] - parsed[begin[idx]]) % (i - begin[idx]) == 0) {
                            // we can decide the inc
                            inc[idx] = (parsed[i] - parsed[begin[idx]]) / (i - begin[idx]);
                            if (inc[idx] > 0) {
                                // then check if the prev buffer can hold it
                                if ((begin[idx] - end[idx - 1] - 1) > (parsed[begin[idx]] - 1) / inc[idx]) {
                                    // it can't
                                    begin[idx] = end[idx - 1] + 1;
                                    inc[idx] = 0;
                                    end[idx] = i - 1;
                                    idx++;
                                    begin[idx] = i;
                                    inc[idx] = Integer.MAX_VALUE;
                                } else {
                                    // shift the begin, use up the buffer
                                    parsed[end[idx - 1] + 1] = parsed[begin[idx]] - (begin[idx] - end[idx - 1] + 1) * inc[idx];
                                    begin[idx] = end[idx - 1] + 1;
                                }
                            } // otherwise it can always hold
                        } else {
                            // we can not decide the inc, we must break the buffer instead
                            // the case 0000000100000 can not be decided directly
                            // update, the case above, we set inc = 0
                            //         that seems to be the best solution
                            //         other inc value may introduce new seq
                            // case when prev buffer is enough
                            // set cur inc = 1
                            // set new seq starting i
                            // if buffer is enough then prev seq should be decided
                            // if next buffer is enough (also use parsed[i] to check this)
                            // set cur inc = -1
                            // set new seq starting i
                            // if no buffer is enough
                            // set cur inc = -1
                            // set begin and end accordingly
                            // set new seq starting i
                            inc[idx] = 0;
                            parsed[end[idx - 1] + 1] = parsed[begin[idx]] + begin[idx] - end[idx - 1] - 1;;
                            begin[idx] = end[idx - 1] + 1;
                            end[idx] = i - 1;
                            idx++;
                            begin[idx] = i;
                            inc[idx] = Integer.MAX_VALUE;
                        }
                    }
                }

            }
        }
        if (end[idx] < 1) {
            if (inc[idx] != Integer.MAX_VALUE) {
                end[idx] = as.length - 1;
            } else {
                if (begin[idx] == -1) {
                    begin[idx] = 0;
                    end[idx] = as.length - 1;
                } else if (parsed[begin[idx]] >= begin[idx] - end[idx - 1]) {
                    inc[idx] = 1;
                    parsed[end[idx - 1] + 1] = parsed[begin[idx]] - begin[idx] + end[idx - 1] + 1;
                    begin[idx] = end[idx - 1] + 1;
                    end[idx] = as.length - 1;
                } else {
                    inc[idx] = 0;
                    parsed[end[idx - 1] + 1] = parsed[begin[idx]] + begin[idx] - end[idx - 1] - 1;
                    end[idx] = as.length - 1;
                    begin[idx] = end[idx - 1] + 1;
                }
            }
        }
//        for (int i = 0; i < idx + 1; ++i) {
//            System.out.print(begin[i] + " ");
//        }
//        System.out.println();
//        for (int i = 0; i < idx + 1; ++i) {
//            System.out.print(end[i] + " ");
//        }
//        System.out.println();
//        for (int i = 0; i < idx + 1; ++i) {
//            System.out.print(inc[i] + " ");
//        }
//        System.out.println();
        return idx;
    }

    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            br.readLine();
            String s = br.readLine();
            String as[] = s.split(" ");
            System.out.println(solve(as));
        } catch (IOException ex) {
        }
    }
}