#include #include using namespace std; int N,L[8],R[8]; int dp[1<<8]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N; for(int i=0;i>L[i]>>R[i]; dp[0]=1; for(int i=0;i<1<>j&1)Lm=max(Lm,L[j]); for(int j=0;j>j&1)&&Lm<=R[j])dp[i|1<