import java.io.*;
import java.util.StringTokenizer;

public class D {

    public static void main(String[] args) throws IOException {
        init();

        int n = nextInt();

        String[] matrix = new String[n];

        for (int i = 0; i < matrix.length; i++) matrix[i] = next();
        char rep = matrix[0].charAt(0);
        boolean isN = rep == 'F' || rep == '0';
        for (String row : matrix) {
            for (int j = 0; j < row.length(); j++) {
                if (row.charAt(j) != rep) {
                    isN = false;
                    break;
                }
            }
            if (!isN) break;
        }

        System.out.println(isN ? n : 1);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

//    private static long nextLong() throws IOException {
//        return Long.parseLong(next());
//    }
//
//    //    Get a whole line.
//    private static String line() throws IOException {
//        return reader.readLine();
//    }
//
//    private static double nextDouble() throws IOException {
//        return Double.parseDouble(next());
//    }
}