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

public class D {

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    private static class Solver {

        private void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();

            char[][] a = new char[n][n / 4];
            HashSet<Character> hs = new HashSet<>();
            for (int i = 0; i < n; i++) {
                a[i] = in.next().toCharArray();
                for (int j = 0; j < n / 4; j++) {
                    hs.add(a[i][j]);
                }
            }

            if (hs.size() == 1 && (hs.contains('0') || hs.contains('F'))) {
                out.println(n);
            } else {
                out.println(1);
            }
        }
    }

    private static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

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

        private long nextLong() {
            return Long.parseLong(next());
        }

        private double nextDouble() {
            return Double.parseDouble(next());
        }

        private String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        private String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
    }
}