Intervals
题号:NC237348
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

You are given  limits, each with three positive integers .

Computes the minimal size of a set  of integers which has at least  common elements with interval , for each .

输入描述:

The first line contains a integers  ().

The next  lines contains three integers  ().

It is guaranteed that , for each .

输出描述:

Print the number of the minimal size of set .
示例1

输入

复制
5
1 3 1
3 7 3
6 8 1
8 10 3
10 11 1

输出

复制
6