// Arup Guha
// 3/22/2015
// Solution to December 2013 USACO Bronze Problem: Record Keeping

import java.util.*;
import java.io.*;

public class records {

	final public static long MAX = 3000L;

	public static void main(String[] args) throws Exception {

		Scanner stdin = new Scanner(new File("records.in"));
		int n = stdin.nextInt();
		HashMap<String,Integer> nameMap = new HashMap<String,Integer>();
		HashMap<Long,Integer> lookup = new HashMap<Long,Integer>();
		int curID = 0, result = 0;

		// Go through each name.
		for (int i=0; i<n; i++) {

			// Stores the codes of each name.
			int[] codes = new int[3];
			for (int j=0; j<3; j++) {

				String s = stdin.next();
				int ID = -1;

				// Just look up this cow's ID.
				if (nameMap.containsKey(s))
					ID = nameMap.get(s);

				// Form its ID.
				else {
					ID = curID;
					nameMap.put(s, ID);
					curID++;
				}

				// Store it.
				codes[j] = ID;
			}

			// Make sure order doesn't matter.
			Arrays.sort(codes);

			// Make it easy for the hashmap.
			long key = MAX*MAX*codes[0] + MAX*codes[1] + codes[2];

			// Seen this before.
			if (lookup.containsKey(key)) {
				int value = lookup.get(key);
				lookup.put(key, value+1);
				result = Math.max(result, value+1);
			}

			// First time.
			else
				lookup.put(key, 1);
		}
		stdin.close();

		// Write out the result.
		BufferedWriter fout = new BufferedWriter(new FileWriter("records.out"));
		fout.write(result+"\n");
		fout.close();
	}
}
