Canonicalized Input Description:

An integer N (1 ≤ N ≤ 10^5), representing some quantity or size.
An integer M (1 ≤ M ≤ 10^5), representing some quantity or size.
A list of M tuples, each tuple containing two integers L_i and R_i (1 ≤ L_i ≤ R_i ≤ N).

### Example Input:

```
4 2
1 3
2 4
```

### Function Signature:

Write a function f(N, M, intervals) that takes in the input.

```python
def f(N: int, M: int, intervals: List[Tuple[int, int]]):
    '''
    N: an integer
    M: an integer
    intervals: a list of tuples, each containing two integers
    '''
```