Question

Programming Languages

1 2 2 1 3 4

1

The first language has the required features --- features 1 and 2.

Ram is a software developer, so he has to switch between different languages sometimes. Each programming language has some features, which are represented by integers here. Currently, Ram has to use a language with two given features A and B. He has two options --- switching to a language with two features A1 and B1, or to a language with two features A2 and B2. All four features of these two languages are pairwise distinct. Tell Ram whether he can use the first language, the second language or neither of these languages (if no single language has all the required features).

Input

The first and only line of each test case contains six space-separated integers A, B, A1, B1, A2, B2 respectively.

1 ≤ A, B, A1, B1, A2, B2 ≤ 4

A and B are distinct

A1,B1,A2,B2 re pairwise distinct.

**Constraints**1 ≤ A, B, A1, B1, A2, B2 ≤ 4

A and B are distinct

A1,B1,A2,B2 re pairwise distinct.

Output

Return a single line containing the integer 1 if Ram should switch to the first language, or 2 if Ram should switch to the second language, or 0 if Ram cannot switch to either language.

Example

**Sample Input**

1 2 2 1 3 4

**Sample Output**

1

**Explanation**

The first language has the required features --- features 1 and 2.