// Arup Guha
// 11/6/2016
// Solution to 2016 SER D2 Problem: It Takes Three

import java.util.*;

public class threesq {

	public static void main(String[] args) {

		// Get data.
		Scanner stdin = new Scanner(System.in);
		int[] a = new int[2];
		int[] b = new int[2];
		int[] c = new int[2];
		for (int i=0; i<2; i++) a[i] = stdin.nextInt();
		for (int i=0; i<2; i++) b[i] = stdin.nextInt();
		for (int i=0; i<2; i++) c[i] = stdin.nextInt();

		// Sort it.
		Arrays.sort(a);
		Arrays.sort(b);
		Arrays.sort(c);

		// Solve it.
		System.out.println(solve(a,b,c));
	}

	public static int special(int[] a, int[] b, int[] c) {

		// Check special case that two of the three are equal - we try both ways.
		if (equal(a,b)) {

			// This is one way.
			int[] d = new int[2];
			d[0] = 2*a[0]; d[1] = a[1];
			int[] res = merge(d,c);
			if (res != null && res[0] == res[1]) return 1;

			// And this is the other.
			d[0] = 2*a[1]; d[1] = a[0];
			res = merge(d,c);
			if (res != null && res[0] == res[1]) return 1;
		}

		// Can't do it if we get here.
		return 0;
	}

	// Returns true if a[i] = b[i] for all i.
	public static boolean equal(int[] a, int[] b) {
		for (int i=0; i<a.length; i++)
			if (a[i] != b[i])
				return false;
		return true;
	}

	public static int solve(int[] a,int[] b, int[] c) {

		// Get rid of these silly cases.
		if (special(a,b,c) == 1) return 1;
		if (special(a,c,b) == 1) return 1;
		if (special(b,c,a) == 1) return 1;

		// Now we know our initial merge will return one answer at most, try all three.

		// AB together first.
		int[] ab = merge(a,b);
		if (ab != null) {

			// Also a special case, so take care of it.
			if (equal(ab,c) && c[0]*2 == c[1]) return 1;
			int[] res = merge(ab, c);
			if (res != null && res[0] == res[1]) return 1;
		}

		// Then AC.
		int[] ac = merge(a,c);
		if (ac != null) {
			if (equal(ac,b) && b[0]*2 == b[1]) return 1;
			int[] res = merge(ac, b);
			if (res != null && res[0] == res[1]) return 1;
		}

		// Finally BC.
		int[] bc = merge(b,c);
		if (bc != null) {
			if (equal(bc,a) && a[0]*2 == a[1]) return 1;
			int[] res = merge(bc, a);
			if (res != null && res[0] == res[1]) return 1;
		}
		return 0;
	}

	// Just returns the first way to merge rectangles a and b.
	public static int[] merge(int[] a, int[] b) {
		for (int i=0; i<2; i++) {
			for (int j=0; j<2; j++) {
				if (a[i] == b[j]) {
					int[] res = new int[2];
					res[0] = a[i];
					res[1] = a[1-i] +b[1-j];
					return res;
				}
			}
		}

		// If we get here, these 2 can't merge.
		return null;
	}
}