// Arup Guha
// 11/14/2015
// Solution to 2015 SER D2 Problem: Triangles

import java.util.*;

public class triangles {

	public static void main(String[] args) {

		// Read in input.
		Scanner stdin = new Scanner(System.in);
		int[] tri1 = new int[3];
		int[] tri2 = new int[3];

		for (int i=0; i<3; i++)
			tri1[i] = stdin.nextInt();
		for (int i=0; i<3; i++)
			tri2[i] = stdin.nextInt();

		// Sort it.
		Arrays.sort(tri1);
		Arrays.sort(tri2);

		// Both triangles must be the same and must be right triangles.
		if (!equal(tri1, tri2) || tri1[0]*tri1[0] + tri1[1]*tri1[1] != tri1[2]*tri1[2])
			System.out.println(0);
		else
			System.out.println(1);
	}

	// Pre-condition: lenghts of arr1, arr2 are the same.
	// Post-condition: returns true iff contents and order of both arrays is the same.
	public static boolean equal(int[] arr1, int[] arr2) {
		for (int i=0; i<arr1.length; i++)
			if (arr1[i] != arr2[i])
				return false;
		return true;
	}
}
