import java.io.*; import java.util.*; import java.awt.geom.*; /** * Solution to Triangle * * @author vanb */ public class triangle_vanb { public Scanner sc; public PrintStream ps; /** * Driver. * @throws Exception */ public void doit() throws Exception { sc = new Scanner( System.in ); ps = System.out; int t1[] = new int[3]; int t2[] = new int[3]; t1[0] = sc.nextInt(); t1[1] = sc.nextInt(); t1[2] = sc.nextInt(); t2[0] = sc.nextInt(); t2[1] = sc.nextInt(); t2[2] = sc.nextInt(); // Just sort them, and if they're identical (and they satisfy the pythagorean theorem), // then it works. Otherwise, it doesn't. Arrays.sort( t1 ); Arrays.sort( t2 ); // Do they satisfy the Pythagorean Theorem? // They have to form a right triangle, if they came from a rectangle. // The Pythagorean Theorem sez that if a, b and c are the lengths of // the sides of a right triangle, with c being the longest (the Hypotenuse, // the side opposite the right angle) then a^2 + b^2 = c^2 boolean ok = (t1[0]*t1[0] + t1[1]*t1[1] == t1[2]*t1[2]); // Are they identical? ok &= (t1[0]==t2[0] && t1[1]==t2[1] && t1[2]==t2[2]); ps.println( ok ? "1" : "0" ); } /** * @param args */ public static void main( String[] args ) throws Exception { new triangle_vanb().doit(); } }