#include <bits/stdc++.h>
int a[101][101];
int n, m;
int check(int a[][101], int start, int end) {
  for (int i = start; i <= (start + end) / 2; i++) {
    for (int j = 1; j <= n; j++)
      if (a[i][j] != a[start + end - i][j]) return 0;
  }
  return 1;
}
int getNum(int a[][101], int start, int end) {
  if ((end - start + 1) % 2 == 1) return end - start + 1;
  if (check(a, start, end))
    return getNum(a, start, (start + end) / 2);
  else
    return end - start + 1;
}
int main() {
  while (scanf("%d %d", &m, &n) != -1) {
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        scanf("%d", &a[i][j]);
      }
    }
    printf("%d\n", getNum(a, 1, m));
  }
  return 0;
}
