#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

template <typename T>
T powint(T a, ll n) {
    T ret = 1;
    while (n > 0) {
        if (n & 1) ret *= a; 
        a *= a;
        n >>= 1;
    }
    return ret;
}

template <ll mod>
class ModInt {
private:
    ll num;
public:
    ModInt() {};
    ModInt(ll n) { num = n % mod; }
    ModInt inv() const { return powint(*this, mod-2); }
    explicit operator ll() const { return num; }

    ModInt& operator+=(const ModInt& a) {
        num += a.num; 
        if (num >= mod) num -= mod; 
        return *this;
    }
    ModInt& operator-=(const ModInt& a) {
        if (num < a.num) num += mod;
        num -= a.num;
        return *this;
    }
    ModInt& operator*=(const ModInt& a) {
        num = num * a.num % mod;
        return *this;
    }
    ModInt& operator/=(const ModInt& a) { return *this *= a.inv(); }
    friend ModInt operator+(const ModInt& a, const ModInt& b) { return ModInt(a) += b; }
    friend ModInt operator-(const ModInt& a, const ModInt& b) { return ModInt(a) -= b; }
    friend ModInt operator*(const ModInt& a, const ModInt& b) { return ModInt(a) *= b; }
    friend ModInt operator/(const ModInt& a, const ModInt& b) { return ModInt(a) /= b; }

    friend ostream& operator<<(ostream& os, const ModInt& a) { return os << a.num; }
    friend istream& operator>>(istream& is, ModInt& a) {
        ll tmp;
        is >> tmp;
        a.num = tmp % mod;
        return is;
    }
};
// using mint = ModInt<1000000007>;
using mint = ModInt<998244353>;

template <class Monoid>
struct SegTree {
    using T = typename Monoid::type;
    Monoid M;
    int n;
    vector<T> v;

    SegTree(int sz, const Monoid &m = Monoid()) : M(m) {
        n = 1;
        while (n < sz) n *= 2;
        v.assign(n * 2, M.id());
    }
    SegTree(int sz, const vector<T> &init, const Monoid &m = Monoid()) : SegTree(sz, m) {
        copy(init.begin(), init.end(), v.begin() + n);
        for (int k = n-1; k > 0; k--) {
            v[k] = M.append(v[2*k+0], v[2*k+1]);
        }
    }
    void point_set(int i, T a) {
        int k = i + n;
        v[k] = a;
        while(k >>= 1) {
            v[k] = M.append(v[k*2+0], v[k*2+1]);
        }
    }
    T range_concat(int a, int b) {
        return range_concat(a, b, 1, 0, n);
    }
    T range_concat(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return M.id();
        if (a <= l && r <= b) return v[k];
        T vl = range_concat(a, b, k*2+0, l, (l + r) / 2);
        T vr = range_concat(a, b, k*2+1, (l + r) / 2, r);
        return M.append(vl, vr);
    }
};

struct maxmn {
    using type = ll;
    type id() {return -(1LL << 31);}
    type append(type a, type b) {return max(a, b);}
};

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (auto &e: a) cin >> e.first >> e.second;
    sort(a.rbegin(), a.rend());

    vector<int> dict(2*n);
    for (int i = 0; i < n; ++i) {
        dict[i*2] = a[i].first;
        dict[i*2+1] = a[i].second;
    }
    sort(dict.begin(), dict.end());
    dict.erase(unique(dict.begin(), dict.end()), dict.end());
    auto conv = [&](int x){
        return lower_bound(dict.begin(), dict.end(), x) - dict.begin();
    };

    SegTree<maxmn> seg(dict.size());
    for (auto &e: a) {
        int x, d;
        tie(x, d) = e;
        int nd = max((ll)x+d, seg.range_concat(conv(x), conv(x+d)));
        seg.point_set(conv(x), nd);
        e.second = nd;
    }

    vector<pair<int, int>> evt;
    for (auto &e: a) {
        evt.emplace_back(e.first, 1);
        evt.emplace_back(e.second, 0);
    }
    sort(evt.begin(), evt.end());

    stack<mint> st;
    st.push(1);
    for (auto &e: evt) {
        if (e.second == 1) {
            st.push(1);
        } else if (e.second == 0) {
            mint t = st.top();
            st.pop();
            st.top() *= (t+1);
        }
    }

    cout << st.top() << endl;

    return 0;
}


Measured memory_bytes: 17776