import bisect import copy mod = 998244353 class BinaryIndexedTree: def __init__(self, n): self.n = n self.data = [0] * (n + 1) def add(self, k, x): k += 1 while k <= self.n: self.data[k] += x self.data[k] %= mod k += k & -k def sum(self, k): res = 0 while k: res += self.data[k] res %= mod k -= k & -k return res def compress(A): B = sorted(list(set(A))) for i in range(len(A)): A[i] = bisect.bisect_left(B, A[i]) return len(B) N = int(input()) X = [] Y = [] for i in range(N): a, b = map(int, input().split()) X += [a + b] Y += [a - b] if X[0] > X[-1]: for i in range(N): X[i] = -X[i] if Y[0] > Y[-1]: for i in range(N): Y[i] = -Y[i] compress(X) K = compress(Y) A = [] for i in range(N): if X[0] > X[i] or X[i] > X[-1]: continue if Y[0] > Y[i] or Y[i] > Y[-1]: continue A += [(X[i], Y[i])] M = len(A) A.sort() BIT = BinaryIndexedTree(K) for i in range(M): if i == 0: BIT.add(0, 1) elif i == M - 1: print(BIT.sum(K)) else: BIT.add(A[i][1], BIT.sum(A[i][1] + 1))