
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;

class Mar27 {
	public static void main(String[] args) {

		Scanner fin = null;

		try {
			fin = new Scanner(new File("boxes.txt"));
		}
		catch(FileNotFoundException e) {
			System.out.println("bad file");
			System.exit(0);
		}

		fin.useDelimiter(",|\n");
		
		int numBoxes = fin.nextInt();
	
		Box[] boxes = new Box[numBoxes];

		for(int i = 0; i < numBoxes; i++) {
			int h = fin.nextInt();
			int w = fin.nextInt();
			int l = fin.nextInt();
			double weight = fin.nextDouble();

			Box b = new Box(h,w,l,weight);
			boxes[i] = b;
		}			

		for(int i = 0; i < numBoxes; i++) {
			System.out.println(boxes[i]);
		}
	
		Box firstBox = boxes[0];
		int counter = 0;

		for(int i = 1; i < numBoxes; i++) {
			if (firstBox.equals(boxes[i])) {
				System.out.println("found equal box");
				counter++;
			}
		}

		System.out.println("Number of equal boxes: " + counter);	
		PrintWriter pw = null;

		try {
			pw = new PrintWriter(new File("boxes.bkup"));
		}
		catch (FileNotFoundException e) {
			System.out.println("cannot write to file");
			System.exit(0);
		}

		for(int i = 0; i < numBoxes; i++) {
			pw.println(boxes[i]);
		}
	
		pw.close();


	}
}
