cswork / OAOpen practice workspace

ZscalerOA #2

Signal Filter

Estimated EasyJudge-ready

Topics (AI-labelled)Prefix & Ranges

A signal must fall within all closed intervals at once; count the frequencies that pass every filter.

See "Input" for the standard input/output conventions and constraints added by this site.

Input

n,m≤100000; frequencies and endpoints are 32-bit integers. Input n m, the frequencies, and m intervals.

Output

Output the number that pass.

Example 1

Input:

5 3
8 15 14 16 21
10 17
13 15
13 17

Output:

2

Example 2

Input:

3 2
0 10 20
-1 30
0 20

Output:

3

Example 3

Input:

3 1
1 2 3
4 9

Output:

0

Editorial

Loading solution…