#include #include #include using namespace std; using ll = long long; #include int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; vector t(n),a(n),b(n); vector dx; for(int i = 0;i>t[i]>>a[i]>>b[i]; dx.push_back(a[i]); dx.push_back(b[i]+1); } sort(dx.begin(),dx.end()); dx.erase(unique(dx.begin(),dx.end()),dx.end()); int m = dx.size(); ll ans = 0; atcoder::fenwick_tree bit(m); for(int i = 0;i