const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let l = 0;
rl.on('line', (input) => {
    if (l === 0) {} else {
        rl.close();
        let hm = {}
        let arr = input.split(" ").map(x=>parseInt(x))
        let mn1 = 9999999
        let nr = 0
        for(let i=1;i<=100;i++){
            let s=0
                for(let j=0;j<arr.length;j++){
                   s+=Math.min(Math.min(Math.abs(i-arr[j]), Math.abs(i-arr[j]-1)),Math.abs(i-arr[j]+1))
                }
                if(s<mn1){
                    mn1=s;
                    nr=i
                }
        }
        console.log(nr,mn1)
        return
    }
    l++
})

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  let [min, t] = [Infinity, 1];

  for (let i = 1; i <= 1000; i++) {
    const target = i;
    let count = 0;
    for (let j = 0; j < len; j++) {
      const current = arr[j];
      const diff = Math.abs(target - current);
      if (diff > 1) {
        count += diff - 1;
      }
    }
    if (count < min) {
      min = count;
      t = target;
    }
  }

  console.log(`${t} ${min}`);
}

function ansa(n,arr){

  var ans = []
  ans[0] = Infinity
  for(var i = 1 ; i < 101 ; i++){

    ans[i] = 0

    for(var j = 0 ; j < n ; j++){

      ans[i] += Math.abs(arr[j] - i);
      if(Math.abs(arr[j] - i) !== 0) ans[i]--

    }
  }
  var min =  Math.min(...ans);
  print(ans.indexOf(min) + " " + min)
}

var line = readline().split(' ')
var arr = readline().split(' ')
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);
ansa(parseInt(line[0]),arr)

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  let [min, t] = [Infinity, 1];

  for (let i = 0; i < len; i++) {
    const target = arr[i];
    let count = 0;
    for (let j = 0; j < len; j++) {
      const current = arr[j];
      const diff = Math.abs(target - current);
      if (diff > 1) {
        count += diff - 1;
      }
    }
    if (count < min) {
      min = count;
      t = target;
    }
  }

  console.log(`${t} ${min}`);
}


const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let a;
const mod = 998244353;
function cnk(n, k) {
    if (k > n - k)
        k = n - k;
    return a[n][k];
}

function precalc(n) {
   a = new Array(n + 1);
   a[0] = new Array(1);
   a[0][0] = 1;
   for(let i = 1; i <= n; i++) {
       a[i] = new Array(Math.floor(i / 2) + 1);
       for(let j = 0; j <= Math.floor(i / 2); j++) {
           if (j === 0) {
               a[i][j] = 1;
           } else {
               a[i][j] = cnk(i-1,j-1);
               if (i > j) {
                   a[i][j] = (a[i][j] + cnk(i-1,j)) % mod;
               }
           }
       }
   }
}

let solve = async () => {
    const [n,k] = (await getLine()).split(' ').map(num => parseInt(num));
    precalc(n);
    const nk = cnk(4,2);
    const s = await getLine();
    let l,r;
    if (k===0) {
        console.log('1');
        return;
    }
    for(l = 0; l < s.length && s.charAt(l) === '0'; l++);
    if (l >= s.length) {
        console.log('1');
        return;
    }

    if (k === 1)
        r = l;
    else {
        let count = k - 1;
        for (r = l + 1; r < s.length && count > 0;)
            if (s.charAt(r) === '1') {
                count--;
                if (count > 0) {
                    r++;
                }
            } else r++;
        if (r >= s.length) {
            console.log('1');
            return;
        }
    }

    let res = 1;
    while (r < s.length) {
        let ll = l;
        let rr = r;
        while (rr + 1 < s.length && s.charAt(rr + 1) === '0') {
            rr++;
        }
        while (ll - 1 >= 0 && s.charAt(ll - 1) === '0') {
            ll--;
            res = (res + cnk(rr - ll, k - 1)) % mod;
        }
        ll = l + 1;
        while (rr - ll >= k - 1) {
            res = (res + cnk(rr - ll, k - 1)) % mod;
            ll++;
        }

        if (rr === s.length - 1) {
            res = (res + cnk(rr - l,k - 1) + mod - 1) % mod;
        }

        r++;
        while (r < s.length && s.charAt(r) === '0') r++;
        l++;
        while (l < s.length && s.charAt(l) === '0') l++;
    }

    console.log(res);

}

solve();

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
// const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, k] = lines[l++].trim().split(' ').map(Number)
        const s = lines[l++]
        output[i] = solve(n, k, s)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, s) {
    const ps = []
    for (let i = 0; i < s.length; i++) {
        if (s[i] === '1') ps.push(i)
    }
    if (ps.length < k) return 1

    const cache = combo(n)
    let ans = 1
    let j = 0
    for (let i = 0; i < s.length; i++) {
        const d = (j + k < ps.length ? ps[j + k] : n) - 1 - i
        let c
        if (s[i] === '1') {
            c = Math.min(ps.length - j, k)
        } else {
            c = Math.min(ps.length - j - 1, k - 1)
        }
        // const c = Math.min(ps.length - j, s[i] === '1' ? k : k - 1)
        if (d > 0 && c >= 0 && d >= c && j < ps.length) {
            ans = add(ans, cache[d][c])
        }
        // console.log(d, c)
        if (s[i] === '1') {
            j++
        }
    }
    return ans
}
const MOD = 998244353
function add(a, b) {
    return (a + b) % MOD
}
function combo(n) {
    const r = []
    for (let i = 1; i <= n; i++) {
        r[i] = []
        for (let j = 0; j <= n; j++) {
            if (i === 1 || !j || i <= j) {
                r[i][j] = 1
                continue
            }
            r[i][j] = add(r[i - 1][j - 1], r[i - 1][j])
        }
    }
    return r
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
// const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, k] = lines[l++].trim().split(' ').map(Number)
        const s = lines[l++]
        output[i] = solve(n, k, s)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, s) {
    const ps = []
    for (let i = 0; i < s.length; i++) {
        if (s[i] === '1') ps.push(i)
    }
    if (ps.length < k) return 1

    const cache = combo(n)
    let ans = 1
    let j = 0
    for (let i = 0; i < s.length; i++) {
        const d = (j + k < ps.length ? ps[j + k] : n) - 1 - i
        let c
        if (s[i] === '1') {
            c = Math.min(ps.length - j, k)
        } else {
            c = Math.min(ps.length - j - 1, k - 1)
        }
        // const c = Math.min(ps.length - j, s[i] === '1' ? k : k - 1)
        if (d > 0 && c >= 0 && j < ps.length) {
            ans = add(ans, cache[d][c])
        }
        // console.log(d, c)
        if (s[i] === '1') {
            j++
        }
    }
    return ans
}
const MOD = 998244353
function add(a, b) {
    return (a + b) % MOD
}
function combo(n) {
    const r = []
    for (let i = 1; i <= n; i++) {
        r[i] = []
        for (let j = 0; j <= n; j++) {
            if (i === 1 || !j || i <= j) {
                r[i][j] = 1
                continue
            }
            r[i][j] = add(r[i - 1][j - 1], r[i - 1][j])
        }
    }
    return r
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
// const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = 1//+lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const [n, k] = lines[l++].trim().split(' ').map(Number)
        const s = lines[l++]
        output[i] = solve(n, k, s)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, k, s) {
    const ps = []
    for (let i = 0; i < s.length; i++) {
        if (s[i] === '1') ps.push(i)
    }
    if (ps.length < k) return 1

    const cache = combo(n)
    let ans = 1
    let j = 0
    for (let i = 0; i < s.length; i++) {
        const d = (j + k < ps.length ? ps[j + k] : n) - 1 - i
        let c
        if (s[i] === '1') {
            c = Math.min(ps.length - j, k)
        } else {
            c = Math.min(ps.length - j - 1, k - 1)
        }
        // const c = Math.min(ps.length - j, s[i] === '1' ? k : k - 1)
        if (d > 0 && j < ps.length) {
            ans = add(ans, cache[d][c])
        }
        // console.log(d, c)
        if (s[i] === '1') {
            j++
        }
    }
    return ans
}
const MOD = 998244353
function add(a, b) {
    return (a + b) % MOD
}
function combo(n) {
    const r = []
    for (let i = 1; i <= n; i++) {
        r[i] = []
        for (let j = 0; j <= n; j++) {
            if (i === 1 || !j || i <= j) {
                r[i][j] = 1
                continue
            }
            r[i][j] = add(r[i - 1][j - 1], r[i - 1][j])
        }
    }
    return r
}

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => {
        let next;
        do {
            next = (await getLineGen.next());
        } while (!next.done && next.value === '');
        return next.value;
    };
})();

let a;
const mod = 998244353;
function cnk(n, k) {
    if (k > n - k)
        k = n - k;
    return a[n][k];
}

function precalc(n) {
   a = new Array(n + 1);
   a[0] = new Array(1);
   a[0][0] = 1;
   for(let i = 1; i <= n; i++) {
       a[i] = new Array(Math.floor(i / 2) + 1);
       for(let j = 0; j <= Math.floor(i / 2); j++) {
           if (j === 0) {
               a[i][j] = 1;
           } else {
               a[i][j] = cnk(i-1,j-1);
               if (i > j) {
                   a[i][j] = (a[i][j] + cnk(i-1,j)) % mod;
               }
           }
       }
   }
}

let solve = async () => {
    const [n,k] = (await getLine()).split(' ').map(num => parseInt(num));
    precalc(n);
    const nk = cnk(4,2);
    const s = await getLine();
    let l,r;
    for(l = 0; l < s.length && s.charAt(l) === '0'; l++);
    if (l >= s.length) {
        console.log('1');
        return;
    }
    if (k === 1)
        r = l;
    else {
        let count = k - 1;
        for (r = l + 1; r < s.length && count > 0;)
            if (s.charAt(r) === '1') {
                count--;
                if (count > 0) {
                    r++;
                }
            }
        if (r >= s.length) {
            console.log('1');
            return;
        }
    }

    let res = 1;
    while (r < s.length) {
        /* let ll = l;
         while (true) {
            let rr = r;
            while (true) {
                res = (res + cnk(rr - ll - 1, k - 2)) % mod;
                if (rr === r && ll === l) {
                    res = (res + mod - 1) % mod;
                }
                rr++;
                if (rr >= s.length || s.charAt(rr) === '1')
                    break;
            }
            ll--;
            if (ll < 0 || s.charAt(ll) === '1')
                break;
        } */
        let ll = l;
        let rr = r;
        while (rr + 1 < s.length && s.charAt(rr + 1) === '0') {
            rr++;
        }
        while (ll - 1 >= 0 && s.charAt(ll - 1) === '0') {
            ll--;
            res = (res + cnk(rr - ll, k - 1)) % mod;
        }
        ll = l + 1;
        while (rr - ll >= k - 1) {
            res = (res + cnk(rr - ll, k - 1)) % mod;
            ll++;
        }

        if (rr === s.length - 1) {
            res = (res + cnk(rr - l,k - 1) + mod - 1) % mod;
        }

        r++;
        while (r < s.length && s.charAt(r) === '0') r++;
        l++;
        while (l < s.length && s.charAt(l) === '0') l++;
    }

    console.log(res);

}

solve();


var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort(function(a,b){
    return a<b?-1:(a>b?1:0);
});

print((players[n-1] == players[n])?'NO':'YES');

var length = readline().split(" ").map(function(x) { return parseInt(x); })[0];
var raitings = readline().split(" ").map(function(x) { return parseInt(x); });
raitings.sort(function(a,b) { return a - b;});
var mid = raitings.length / 2;
print(raitings[mid - 1] < raitings[mid] ? "YES" : "NO")

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);}).filter(function(elem){
    return !isNaN(elem);
});
players.sort(function(a,b){
    return a<b?-1:(a>b?1:0);
});

print((players[n-1] == players[n])?'NO':'YES');

var n = parseInt(readline());
var players = readline().split(' ');
for(var i in players){
    players[i] = parseInt(players[i]);
}
players.sort(function(a,b){
    return a<b?-1:(a>b?1:0);
});

print((players[n-1] == players[n])?'NO':'YES');

function cmp(a,b)
{
    return a-b;
}

var n = +readline();
var s = readline();

var a = s.split(' ').map(function(v){return +v;});
a.sort(cmp);
if (a[n-1]===a[n])
{
    print("NO");
}
else
{
    print("YES");
}

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n]>=players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort(function(a,b){
    return a>=b;
});
write((players[n]==players[n-1])?'NO':'YES');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n]<players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort();
print((players[n]>players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n]==players[n-1])?'NO':'YES');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);}).filter(function(elem){
    return !isNaN(elem);
});
players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);
/*print((players[n-1] == players[n])?'NO':'YES');
*/
if((result1 < result2) && (players[n-1] < players[n])){
    print("YES");
}else{
    print("NO");
}

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);}).filter(function(elem){
    return !isNaN(elem);
});
players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n-1] < players[n])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);}).filter(function(elem){
    return !isNaN(elem);
});
players.sort(function(a,b){
    return a>=b;
});
/*var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);*/

print((players[n-1] == players[n])?'NO':'YES');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort(function(a,b){
    return a>=b;
});
print((players[n]>players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>b;
});

write((players[n]>players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort(function(a,b){
    return a>=b;
});
print((players[n]==players[n-1])?'NO':'YES');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n]>players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});
players.sort(function(a,b){
    return a>b;
});
print((players[n]>players[n-1])?'YES':'NO');

var n = parseInt(readline());
var players = readline().split(' ').map(function(term) { return parseInt(term);});

players.sort(function(a,b){
    return a>=b;
});
var result1 = players.slice(0,n).reduce(function(sum, elem){return sum+elem},0);
var result2 = players.slice(n).reduce(function(sum, elem){return sum+elem},0);

print((result1<result2 && players[n-1] < players[n])?'YES':'NO');

var length = readline().split(" ").map(function(x) { return parseInt(x); })[0];
var raitings = readline().split(" ").map(function(x) { return parseInt(x); });
raitings.sort();
var mid = raitings.length / 2;
print(raitings[mid - 1] < raitings[mid] ? "YES" : "NO")


const processData = (lines) => {
  let acc = 0
  const n = +lines[acc]
  acc++
  for (let i=0; i<n; i++) {
    let n = +lines[acc]
    acc++
    const arr = lines[acc].split(' ').map(x => x%2)
    acc++
    const map = {
      0: [],
      1: []
    }
    for (let i =0; i<arr.length; i++) {
      map[arr[i]].push(i)
    }

    let cursor = [0, 0]

    while (n > 1) {
      const l = map[cursor[0]].length
      if (l <= cursor[1]+1) {
        cursor[0] = 1
        cursor[1] = 0
      }
      console.log(map[cursor[0]][cursor[1]]+1, map[cursor[0]][cursor[1]+1]+1)
      cursor[1] += 2
      n--
    }
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

function readStringArray() {
  return readline().split(" ");
}
function readNumArray() {
  return readStringArray().map(Number);
}

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var n = +readline();
    var arr = readNumArray();
    var lastEven = 0;
    var lastOdd = 0;
    var counter = 0;
    for (var j = 1; j <= 2 * n; j++) {
      if (arr[j - 1] % 2) {
        if (lastOdd) {
          print(lastOdd + " " + j);
          lastOdd = 0;
          counter++;
        } else {
          lastOdd = j;
        }
      } else {
        if (lastEven) {
          print(lastEven + " " + j);
          lastEven = 0;
          counter++;
        } else {
          lastEven = j;
        }
      }
      if (counter === n - 1) {
        break;
      }
    }
  }
}

main();

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStd) => {
  inputString += inputStd;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let _ = readLine();
    let arr = readLine()
      .split(" ")
      .map((num) => parseInt(num));
    solve(arr);
  }

  function solve(arr) {
    const evenMap = {};
    const oddMap = {};

    arr.forEach((num, index) => {
      if (num % 2 === 0) evenMap[index + 1] = num;
      else oddMap[index + 1] = num;
    });

    let evenKeys = Object.keys(evenMap);
    let oddKeys = Object.keys(oddMap);

    for (let i = 0; i < arr.length / 2 - 1; i++) {
      if (evenKeys.length >= 2) console.log(`${evenKeys.pop()} ${evenKeys.pop()}`);
      else console.log(`${oddKeys.pop()} ${oddKeys.pop()}`);
    }
  }
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
var input = '';
process.stdin.on('data', function (line) {
    input += line;
});
process.stdin.on('end', function () {
    var lines = input.split('\n');
    var tests = parseInt(lines.shift(), 10);
    var _loop_1 = function () {
        var n = parseInt(lines.shift(), 10);
        var arr = lineToNumArray(lines.shift());
        var indices = [[], []];
        arr.forEach(function (element, index) { return indices[element % 2].push(index); });
        if (indices[0].length % 2) {
            indices[0].shift();
            indices[1].shift();
        }
        else {
            var parity = Number(!indices[0].length);
            indices[parity].shift();
            indices[parity].shift();
        }
        indices.forEach(function (parity) {
            while (parity.length) {
                console.log(1 + parity.pop(), 1 + parity.pop());
            }
        });
    };
    while (tests--) {
        _loop_1();
    }
});
// input helper
function lineToNumArray(line) {
    return line.split(' ').map(function (element) { return parseInt(element, 10); });
}

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStd) => {
  inputString += inputStd;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let _ = readLine();
    let arr = readLine()
      .split(" ")
      .map((num) => parseInt(num));
    solve(arr);
  }

  function solve(arr) {
    const map = { even: [], odd: [] };
    arr.forEach((num) => {
      if (num % 2 === 0) map["even"].push(num);
      else map["odd"].push(num);
    });
    for (let i = 0; i < arr.length / 2 - 1; i++) {
      if (map["even"].length >= 2) console.log(`${map["even"].pop()} ${map["even"].pop()}`);
      else console.log(`${map["odd"].pop()} ${map["odd"].pop()}`);
    }
  }
}


var n = +readline();

const FALL = {
    yes: {},
    maybe: {},
    no: {}
};

var fallType = function (fallTree, blockTree) {
    var distance = Math.abs(fallTree.x - blockTree.x);

    if (fallTree.h + blockTree.h < distance) {
        return FALL.yes;
    }

    if (fallTree.h < distance) {
        return blockTree.h >= distance ? FALL.yes : FALL.maybe;
    }

    return FALL.no;
};

var Tree = function (data) {
    this.x = +data[0];
    this.h = +data[1];
};

Tree.prototype.calculate = function (leftTree, rightTree) {
    this.left = fallType(this, leftTree);
    this.right = fallType(this, rightTree);
};

Tree.prototype.canFall = function () {
    return this.left === FALL.yes || this.right === FALL.yes;
};

Tree.prototype.cantFall = function () {
    return this.left === FALL.no && this.right === FALL.no;
};

var trees = [new Tree([-Infinity, 0])];
for (var i = 0; i < n; ++i) {
    trees.push(new Tree(readline().split(' ')));
}
trees.push(new Tree([+Infinity, 0]));

for (var i = 1; i <= n; ++i) {
    trees[i].calculate(trees[i - 1], trees[i + 1]);
}

var result = 0;
var state = 0;

for (var i = 1; i <= n; ++i) {
    switch (state) {
        case 0:
            if (trees[i].canFall()) {
                ++result;
            } else if (trees[i].cantFall()) {
                // nothing do to here
            } else if (trees[i].left === FALL.no) {
                ++result;
                state = 1;
            } else {
                ++result;
            }
            break;
        case 1:
            if (trees[i].canFall()) {
                ++result;
                state = 0;
            } else if (trees[i].cantFall()) {
                state = 0;
            } else if (trees[i].right === FALL.no) {
                state = 0;
            } else {
                ++result;
            }

            break;
    }
}

write(result);

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = true;

    this.find = function( val , fl ) {
    	var lo , hi , mi , res , sz1 , sz2 ;
    	sz1 = this.brr.length ;
    	sz2 = this.crr.length ;
    	lo = 0 ;
    	if( fl == false ) {
    		hi = sz1 - 1 ;
    	}
    	else {
    		hi = sz2 - 1 ;
    	}
    	res = -1 ;
    	while( lo <= hi ) {
    		mi = Math.floor( ( lo + hi ) / 2 ) ;
    		if( fl == false ) {
    			if( this.brr[ mi ].index < val ) {
    				lo = mi + 1 ;
    				res = Math.max( res , mi ) ;
    			}
    			else {
    				hi = mi - 1 ;
    			}
    		}
    		else {
    			if( this.crr[ mi ].index + this.crr[ mi ].height < val ) {
    				lo = mi + 1 ;
    				res = Math.max( res , mi ) ;
    			}
    			else {
    				hi = mi - 1 ;
    			}
    		}
    	}
    	if( res != -1 ) {
    		if( fl == false ) {
    			res = this.brr[ res ].arrayIndex ;
    		}
    		else {
    			res = this.crr[ res ].arrayIndex ;
    		}
    	}
    	return res ;
    } ;

    this.solveCase = function() {
        var res , i , j ;
        res = 0 ;
        this.arr = this.arr.sort( function( left , right ) { return left.index - right.index ; } ) ;
        this.brr = [] ;
        for( i = 0 ; i < this.n ; i++ ) {
        	if( i == 0 ) {
        		this.brr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        	else if( this.arr[ i ].index - this.arr[ i ].height > this.arr[ i - 1 ].index ) {
        		this.brr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        }
        this.crr = [] ;
        for( i = 0 ; i < this.n ; i++ ) {
        	if( i == this.n - 1 ) {
        		this.crr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        	else if( this.arr[ i ].index + this.arr[ i ].height < this.arr[ i + 1 ].index ) {
        		this.crr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        }
        for( i = 0 ; i < this.n ; i++ ) {
        	this.memo[ i ][ 0 ] = 1 ;
        	this.memo[ i ][ 1 ] = 1 ;
        	if( i > 0 ) {
        		j = this.find( this.arr[ i ].index - this.arr[ i ].height , false ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ j ][ 0 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index - this.arr[ i ].height , true ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ j ][ 1 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index , false ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ j ][ 0 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index , true ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ j ][ 1 ] + 1 ) ;
        		}
	        	this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ i - 1 ][ 0 ] ) ;
	        	this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ i - 1 ][ 1 ] ) ;
        	}
        	res = Math.max( res , this.memo[ i ][ 0 ] ) ;
	        res = Math.max( res , this.memo[ i ][ 1 ] ) ;
        }
        print( res );
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i , obj ;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
            	obj = {} ;
            	obj.index = irObj.nextInt() ;
            	obj.height = irObj.nextInt() ;
                this.arr.push( obj ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.brr = [];
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.idx = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.memo.push( new Array() );
            this.idx.push( new Array() );
            for( j = 0 ; j < 2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.idx[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

function toi(x){return parseInt(x);}
var n=+readline();
if(n==1){
    print("1")
    quit();
}
var treex=[];
var treeh=[];
for(var i=0;i<n;i++){
    var tmp=readline().split(" ").map(toi);
    treex.push(tmp[0]);
    treeh.push(tmp[1]);
}
var res=1;
var pH=0;
for(var i=1;i<n-1;i++){
    if(pH+treeh[i]<treex[i]-treex[i-1]){//left
	pH=0;
	res++;
    }else if(treeh[i]<treex[i+1]-treex[i]){//right
	pH=treeh[i];
	res++;
    }else{
	pH=0;
    }
}
res++;
print(res);

var n = +readline();

const FALL = {
    yes: {},
    maybe: {},
    no: {}
};

var fallType = function (fallTree, blockTree) {
    var distance = Math.abs(fallTree.x - blockTree.x);

    if (fallTree.h + blockTree.h < distance) {
        return FALL.yes;
    }

    if (fallTree.h < distance) {
        return blockTree.h >= distance ? FALL.yes : FALL.maybe;
    }

    return FALL.no;
};

var Tree = function (data) {
    this.x = +data[0];
    this.h = +data[1];
};

Tree.prototype.calculate = function (leftTree, rightTree) {
    this.left = fallType(this, leftTree);
    this.right = fallType(this, rightTree);
};

Tree.prototype.canFall = function () {
    return this.left === FALL.yes || this.right === FALL.yes;
};

Tree.prototype.cantFall = function () {
    return this.left === FALL.no && this.right === FALL.no;
};

var trees = [new Tree([-Infinity, 0])];
for (var i = 0; i < n; ++i) {
    trees.push(new Tree(readline().split(' ')));
}
trees.push(new Tree([+Infinity, 0]));

for (var i = 1; i <= n; ++i) {
    trees[i].calculate(trees[i - 1], trees[i + 1]);
}

var result = 0;
var state = 0;

for (var i = 1; i <= n; ++i) {
    switch (state) {
        case 0:
            if (trees[i].canFall()) {
                ++result;
                state = 0;
            } else {
                if (trees[i].cantFall()) {
                    state = 0;
                } else {
                    if (trees[i].left === FALL.no) {
                        ++result;
                        state = 1;
                    } else {
                        ++result;
                    }
                }
            }
            break;
        case 1:
            if (trees[i].canFall()) {
                ++result;
                state = 0;
            } else {
                if (trees[i].cantFall()) {
                    state = 0;
                } else {
                    if (trees[i].right === FALL.no) {
                        state = 0;
                    } else {
                        ++result;
                    }
                }
            }
            break;
    }
}

write(result);

var n = +readline();

const FALL = {
  yes: {},
  maybe: {},
  no: {}
}

var fallType = function(fallTree, blockTree) {
  var distance = Math.abs(fallTree.x - blockTree.x);

  if (fallTree.h + blockTree.h < distance) {
      return FALL.yes;
  }

  if (fallTree.h < distance) {
      if (blockTree.h >= distance) {
          return FALL.yes;
      }
      else {
          return FALL.maybe;
      }
  }

  return FALL.no;
}

var Tree = function(data) {
  this.x = +data[0];
  this.h = +data[1];
};

Tree.prototype.calculate = function(leftTree, rightTree) {
  this.left = fallType(this, leftTree);
  this.right = fallType(this, rightTree);
};

Tree.prototype.canFall = function() {
  return this.left === FALL.yes || this.right === FALL.yes;
};

Tree.prototype.cantFall = function() {
  return this.left === FALL.no && this.right === FALL.no;
};

Tree.prototype.maybeFall = function() {
  return this.left === FALL.maybe || this.right === FALL.maybe;
};

var trees = [new Tree([-Infinity, 0])];
for (var i = 0; i < n; ++i) {
  trees.push(new Tree(readline().split(' ')));
}
trees.push(new Tree([+Infinity, 0]));

for (var i = 1; i <= n; ++i) {
  trees[i].calculate(trees[i-1], trees[i+1]);
}

var result = 0;
var state = 0;

for (var i = 1; i <= n; ++i) {
  switch (state) {
      case 0:
        if (trees[i].canFall()) {
            ++result;
            state = 0;
        } else {
            if (trees[i].cantFall()) {
                state = 0;
            } else {
                if (trees[i].left === FALL.no) {
                    ++result;
                    state = 1;
                } else {
                    ++result;
                }
            }
        }
        break;
      case 1:
        if (trees[i].canFall()) {
            ++result;
            state = 0;
        } else {
            if (trees[i].cantFall()) {
                state = 0;
            } else {
                if (trees[i].right === FALL.no) {
                    state = 0;
                } else {
                    ++result;
                }
            }
        }
        break;
  }
}

write(result);

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = true;

    this.solveCase = function() {
        var res , i , j , fl , cn , temp , a , b , c , d ;
        res = 0 ;
        this.arr = this.arr.sort( function( left , right ) { return left.index - right.index ; } ) ;
        a = -2000000000 ;
        b = -2000000000 ;
        aa = 0 ;
        bb = 0 ;
        for( i = 0 ; i < this.n ; i++ ) {
        	c = this.arr[ i ].index ;
        	d = this.arr[ i ].height ;
        	if( a < c - d ) {
        		a = c ;
        		aa += 1 ;
        	}
        	else if( b < c - d ) {
        		a = c ;
        		aa += 1 ;
        	}
        	if( b < c ) {
        		b = c + d ;
        		bb += 1 ;
        	}
        	else if( a < c ) {
        		b = c + d ;
        		bb += 1 ;
        	}
        	res = Math.max( res , aa ) ;
        	res = Math.max( res , bb ) ;
        }
        print( res - 1 );
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i , obj ;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
            	obj = {} ;
            	obj.index = irObj.nextInt() ;
            	obj.height = irObj.nextInt() ;
                this.arr.push( obj ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.brr = [];
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

function ProblemSolver() {
    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;
    this.CLEAR_ARRAY_PER_CASE = true;

    this.find = function( val , fl ) {
    	var lo , hi , mi , res , sz1 , sz2 ;
    	sz1 = this.brr.length ;
    	sz2 = this.crr.length ;
    	lo = 0 ;
    	if( fl == false ) {
    		hi = sz1 - 1 ;
    	}
    	else {
    		hi = sz2 - 1 ;
    	}
    	res = -1 ;
    	while( lo <= hi ) {
    		mi = Math.floor( ( lo + hi ) / 2 ) ;
    		if( fl == false ) {
    			if( this.brr[ mi ].index < val ) {
    				lo = mi + 1 ;
    				res = Math.max( res , mi ) ;
    			}
    			else {
    				hi = mi - 1 ;
    			}
    		}
    		else {
    			if( this.crr[ mi ].index + this.crr[ mi ].height < val ) {
    				lo = mi + 1 ;
    				res = Math.max( res , mi ) ;
    			}
    			else {
    				hi = mi - 1 ;
    			}
    		}
    	}
    	if( res != -1 ) {
    		if( fl == false ) {
    			res = this.brr[ res ].arrayIndex ;
    		}
    		else {
    			res = this.crr[ res ].arrayIndex ;
    		}
    	}
    	return res ;
    } ;

    this.solveCase = function() {
        var res , i , j ;
        res = 0 ;
        this.arr = this.arr.sort( function( left , right ) { return left.index - right.index ; } ) ;
        this.brr = [] ;
        for( i = 0 ; i < this.n ; i++ ) {
        	if( i == 0 ) {
        		this.brr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        	else if( this.arr[ i ].index - this.arr[ i ].height > this.arr[ i - 1 ].index ) {
        		this.brr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        }
        this.crr = [] ;
        for( i = 0 ; i < this.n ; i++ ) {
        	if( i == this.n - 1 ) {
        		this.crr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        	else if( this.arr[ i ].index + this.arr[ i ].height < this.arr[ i + 1 ].index ) {
        		this.crr.push( { index : this.arr[ i ].index , height : this.arr[ i ].height , arrayIndex : i } ) ;
        	}
        }
        for( i = 0 ; i < this.n ; i++ ) {
        	this.memo[ i ][ 0 ] = 1 ;
        	this.memo[ i ][ 1 ] = 1 ;
        	if( i > 0 ) {
        		j = this.find( this.arr[ i ].index - this.arr[ i ].height , false ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ j ][ 0 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index - this.arr[ i ].height , true ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ j ][ 1 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index , false ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ j ][ 0 ] + 1 ) ;
        		}
        		j = this.find( this.arr[ i ].index , true ) ;
        		if( j != -1 ) {
        			this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ j ][ 1 ] + 1 ) ;
        		}
	        	this.memo[ i ][ 0 ] = Math.max( this.memo[ i ][ 0 ] , this.memo[ i - 1 ][ 0 ] ) ;
	        	this.memo[ i ][ 1 ] = Math.max( this.memo[ i ][ 1 ] , this.memo[ i - 1 ][ 1 ] ) ;
	        	res = Math.max( res , this.memo[ i ][ 0 ] ) ;
	        	res = Math.max( res , this.memo[ i ][ 1 ] ) ;
        	}
        }
        print( res );
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i , obj ;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
            this.arr = [] ;
            for( i = 0 ; i < this.n ; i++ ) {
            	obj = {} ;
            	obj.index = irObj.nextInt() ;
            	obj.height = irObj.nextInt() ;
                this.arr.push( obj ) ;
            }
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.brr = [];
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        if( this.CLEAR_ARRAY_PER_CASE == true ) {
            this.clearArraysPerCase() ;
        }
    };

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.memo = new Array();
        this.idx = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.memo.push( new Array() );
            this.idx.push( new Array() );
            for( j = 0 ; j < 2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.idx[ i ].push( 0 );
            }
        }
    };

    this.init();
}

function InputReader() {
    var self = this ;
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;
    this.callBackFunction = null ;
    this.parentContext = null ;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhino = function() {
        var brObj , line ;
        importPackage( java.io ) ;
        importPackage( java.lang ) ;
        brObj = new BufferedReader( new InputStreamReader( System[ 'in' ] ) ) ;
        this.allLines = [] ;
        while( true ) {
            line = brObj.readLine() ;
            if( line == null ) {
                break;
            }
            this.allLines.push( line ) ;
        }
    };

    this.readSingleLinesFromNodeJsJudgeServer = function( chunk ) {
        self.chunkData += chunk ;
    };

    this.readEndFromNodeJsJudgeServer = function() {
        self.parseRawData( self.chunkData ) ;
        self.parentContext.runCases() ;
    };

    this.readAllLinesFromNodeJsJudgeServer = function( parentContext ) {
        this.parentContext = parentContext ;
        process.stdin.resume() ;
        process.stdin.setEncoding( 'utf8' ) ;
        this.chunkData = '' ;
        process.stdin.on( 'data' , this.readSingleLinesFromNodeJsJudgeServer ) ;
        process.stdin.on( 'end' , this.readEndFromNodeJsJudgeServer ) ;
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        this.allLines = [] ;
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx;
        if( flag == 0 ) {
            if( this.currrentCharacterIndex != 0 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            res = "";
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += '' + this.allLines[ this.currrentLineNumber ].charAt( i ) ;
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            len = this.allLines[ this.currrentLineNumber ].length;
            if( typeof( len ) == 'function' ) {
                len = this.allLines[ this.currrentLineNumber ].length() ;
            }
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = len - 1 ;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) >= 48 && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) <= 57 ) {
                    res += '' + ( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) - 48 ) ;
                }
                else {
                    res += '' + this.allLines[ this.currrentLineNumber ].charAt( i );
                }
            }
            this.currrentCharacterIndex = endIdx;
            if( endIdx == len - 1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        return this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCases = function() {
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.detectEnvironmentType = function() {
        var environmentType = null ;
        try {
            if( importPackage != null ) {
                environmentType = 'rhino' ;
            }
        }
        catch( ex1 ) {
            try {
                //for nodejs local server check
                if( __dirname != null && readline != null && typeof( readline ) != 'function' ) {
                    environmentType = 'local-node-js' ;
                }
            }
            catch( ex2 ) {
                try {
                    if( readline == null || typeof( readline ) != 'function' ) {
                        environmentType = 'server-node-js' ;
                    }
                    else {
                        try {
                            if( Map != null ) {
                                environmentType = 'spider-monkey' ;
                            }
                            else {
                                environmentType = 'javascript-v8' ;
                            }
                        }
                        catch( ex3 ) {
                            environmentType = 'javascript-v8' ;
                        }
                    }
                }
                catch( ex3 ) {
                    environmentType = 'server-node-js' ;
                }
            }
        }
        return environmentType ;
    };

    this.configureStreamsAndReadInput = function() {
        var testCases , i , hasMoreTestCases , isLocal , localContext , isNodeJsJudgeServer , environmentType ;
        isNodeJsJudgeServer = false ;
        environmentType = this.detectEnvironmentType() ;
        if( environmentType == 'local-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
            this.runCases() ;
        }
        else if( environmentType == 'server-node-js' ) {
            try {
                if( print == null || typeof( print ) != 'function' ) {
                    print = console.log;
                }
            }
            catch( ex ) {
                print = console.log;
            }
            this.irObj.readAllLinesFromNodeJsJudgeServer( this ) ;
        }
        else if( environmentType == 'javascript-v8' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
        else if( environmentType == 'rhino' ) {
            this.irObj.readAllLinesFromRhino();
            this.runCases() ;
        }
        else if( environmentType == 'spider-monkey' ) {
            this.irObj.readAllLines();
            this.runCases() ;
        }
    };

    this.configureStreamsAndReadInput();
}

new CodeExecutioner();

function toi(x){return parseInt(x);}
var n=+readline();
var treex=[];
var treeh=[];
for(var i=0;i<n;i++){
    var tmp=readline().split(" ").map(toi);
    treex.push(tmp[0]);
    treeh.push(tmp[1]);
}
var res=1;
var pH=0;
for(var i=1;i<n-1;i++){
    if(pH+treeh[i]<treex[i]-treex[i-1]){//left
	pH=0;
	res++;
    }else if(treeh[i]<treex[i+1]-treex[i]){//right
	pH=treeh[i];
	res++;
    }else{
	pH=0;
    }
}
res++;
print(res);

var n = +readline();

const FALL = {
  yes: {},
  maybe: {},
  no: {}
}

var fallType = function(fallTree, blockTree) {
  var distance = Math.abs(fallTree.x - blockTree.x);

  if (fallTree.h + blockTree.h < distance) {
      return FALL.yes;
  }

  if (fallTree.h < distance) {
      if (blockTree.h >= distance) {
          return FALL.yes;
      }
      else {
          return FALL.maybe;
      }
  }

  return FALL.no;
}

var Tree = function(data) {
  this.x = +data[0];
  this.h = +data[1];
};

Tree.prototype.calculate = function(leftTree, rightTree) {
  this.left = fallType(this, leftTree);
  this.right = fallType(this, rightTree);
};

Tree.prototype.canFall = function() {
  return this.left === FALL.yes || this.right === FALL.yes;
};

Tree.prototype.cantFall = function() {
  return this.left === FALL.no && this.right === FALL.no;
};

Tree.prototype.maybeFall = function() {
  return this.left === FALL.maybe || this.right === FALL.maybe;
};

var trees = [new Tree([-Infinity, 0])];
for (var i = 0; i < n; ++i) {
  trees.push(new Tree(readline().split(' ')));
}
trees.push(new Tree([+Infinity, 0]));

for (var i = 1; i <= n; ++i) {
  trees[i].calculate(trees[i-1], trees[i+1]);
}

var result = 0;
var state = 0;

for (var i = 1; i <= n; ++i) {
  switch (state) {
      case 0:
        if (trees[i].canFall()) {
            ++result;
        } else {
            if (trees[i].cantFall()) {
                // nothing to do here
            } else {
                if (trees[i].left = FALL.maybe) {
                    ++result;
                } else {
                    ++result;
                    state = 1;
                }
            }
        }
        break;
      case 1:
        if (trees[i].canFall()) {
            ++result;
            state = 0;
        } else {
            if (trees[i].cantFall()) {
                state = 0;
            } else {
                if (trees[i].right = FALL.no) {
                    state = 0;
                } else {
                    ++result;
                }
            }
        }
        break;
  }
}

write(result);

var n = +readline();

const FALL = {
  yes: {},
  maybe: {},
  no: {}
}

var fallType = function(fallTree, blockTree) {
  var distance = Math.abs(fallTree.x - blockTree.x);

  if (fallTree.h + blockTree.h < distance) {
      return FALL.yes;
  }

  if (fallTree.h < distance) {
      if (blockTree.h >= distance) {
          return FALL.yes;
      }
      else {
          return FALL.maybe;
      }
  }

  return FALL.no;
}

var Tree = function(data) {
  this.x = +data[0];
  this.h = +data[1];
};

Tree.prototype.calculate = function(leftTree, rightTree) {
  this.left = fallType(this, leftTree);
  this.right = fallType(this, rightTree);
};

Tree.prototype.canFall = function() {
  return this.left === FALL.yes || this.right === FALL.yes;
};

Tree.prototype.cantFall = function() {
  return this.left === FALL.no && this.right === FALL.no;
};

Tree.prototype.maybeFall = function() {
  return this.left === FALL.maybe || this.right === FALL.maybe;
};

var trees = [new Tree([-Infinity, 0])];
for (var i = 0; i < n; ++i) {
  trees.push(new Tree(readline().split(' ')));
}
trees.push([new Tree([+Infinity, 0])]);

for (var i = 1; i <= n; ++i) {
  trees[i].calculate(trees[i-1], trees[i+1]);
}

var result = 0;
var state = 0;

for (var i = 1; i <= n; ++i) {
  switch (state) {
      case 0:
        if (trees[i].canFall()) {
            ++result;
        } else {
            if (trees[i].cantFall()) {
                // nothing to do here
            } else {
                if (trees[i].left = FALL.maybe) {
                    ++result;
                } else {
                    ++result;
                    state = 1;
                }
            }
        }
        break;
      case 1:
        if (trees[i].canFall()) {
            ++result;
            state = 0;
        } else {
            if (trees[i].cantFall()) {
                state = 0;
            } else {
                if (trees[i].right = FALL.no) {
                    state = 0;
                } else {
                    ++result;
                }
            }
        }
        break;
  }
}

write(result);

var n = +readline(),
    x = [],
    h = [],
    spc = [],
    count = 2;

for (var i = 0; i < n; i ++)
{
  var line = readline().split(' ');
  x[i] = +line[0],
  h[i] = +line[1];
}

for (var i = 1; i < n - 1; i ++)
{
  if (x[i - 1] < x[i] - h[i])
  {
    count ++;
  }
  else if (x[i + 1] > x[i] + h[i])
  {
    x[i] += h[i];
    count ++;
  }
}

print(count);