AT_arc226_a [ARC226A] Meeting Division
Description
There are $ N $ meetings numbered $ 1,2,\dots,N $ . Meeting $ i $ starts at time $ S_i $ and ends at time $ T_i $ .
Takahashi and Aoki are going to assign exactly one of themselves to each meeting as the person in charge. The same person cannot be in charge of two meetings that overlap for a positive length of time. More formally, the same person can be in charge of meetings $ i $ and $ j $ only if $ T_i \le S_j $ or $ T_j \le S_i $ .
Find the number, modulo $ 998244353 $ , of ways to assign the people in charge that satisfy the conditions.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ S_1 $ $ T_1 $ $ S_2 $ $ T_2 $ $ \vdots $ $ S_N $ $ T_N $
Output Format
Output the number, modulo $ 998244353 $ , of ways to assign the people in charge that satisfy the conditions.
Explanation/Hint
### Sample Explanation 1
The following four assignments satisfy the conditions:
- Takahashi is in charge of meetings $ 1,3 $ , and Aoki is in charge of meeting $ 2 $ .
- Takahashi is in charge of meeting $ 1 $ , and Aoki is in charge of meetings $ 2,3 $ .
- Takahashi is in charge of meetings $ 2,3 $ , and Aoki is in charge of meeting $ 1 $ .
- Takahashi is in charge of meeting $ 2 $ , and Aoki is in charge of meetings $ 1,3 $ .
### Sample Explanation 2
Zero assignments satisfy the conditions.
### Constraints
- $ 1 \le N \le 3 \times 10^5 $
- $ 1 \le S_i < T_i \le 2N $
- $ S_1,T_1,S_2,T_2,\dots,S_N,T_N $ are all different.
- All input values are integers.