408515: GYM103176 H Hacking

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Hackingtime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The Largest Security Professional Challenge (LSPC) is a team contest. Each team consists of 3 hackers, and team shall hack as many websites as possible in 4 hours.

This year, LSPC's problemset consists of three websites to be hacked, each of different hacking difficulties. The hacking difficulties of the three websites can be represented as integers: $$$d_1$$$, $$$d_2$$$ and $$$d_3$$$, where $$$d_1 < d_2 < d_3$$$. This means that website $$$1$$$ is the easiest to hack, with difficulty of $$$d_1$$$, followed by website $$$2$$$ with difficulty $$$d_2$$$. Website $$$3$$$ is the hardest to hack, with difficulty of $$$d_3$$$.

The team from Hackerland consists of three members: Alice, Bob and Charles, each of different hacking skills. The hacking skills of the three members can also be represented as integers: $$$s_A$$$, $$$s_B$$$ and $$$s_C$$$, where $$$s_A < s_B < s_C$$$. This means that Alice with skill level $$$s_A$$$ is the weakest hacker in the team, followed by Bob with skill level $$$s_B$$$. Charles, as the best hacker in the team, has skill level $$$s_C$$$.

A Hacker $$$i$$$ is skillful enough to hack website $$$j$$$ if and only if the hacker's skill level is strictly greater than the hacking difficulty of the website, i.e. $$$s_i > d_j$$$.

As the contest time is limited, each hacker can hack NO MORE THAN ONE website during the whole contest time.

Given the hacking difficulties of the three websites, and the skill levels of the three hackers, what is the maximum number of websites that can be hacked?

Input

The first line consists of three integers $$$d_1, d_2, d_3$$$ ($$$1\le d_1 < d_2 < d_3\le 100$$$).

The second line consists of three integers $$$s_A, s_B, s_C$$$ ($$$1\le s_A < s_B < s_C\le 100$$$).

Output

A single integer, indicating the maximum number of websites that can be hacked by the team from Hackerland.

ExamplesInput
10 30 50
20 45 100
Output
3
Input
56 78 90
12 34 56
Output
0
Input
31 41 59
26 53 58
Output
2
Input
2 71 82
8 18 28
Output
1
Input
12 22 32
1 10 100
Output
1
Note

Notice that in Sample 5, although Charles is skillful enough to hack any of the websites, he can only hack one of them during the whole contest time.

加入题单

算法标签: