#include <bits/stdc++.h>
const int N = 102;
int a[N][N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  int h = n;
  while (h % 2 == 0) {
    for (int i = 0; i < h / 2; i++)
      for (int j = 0; j < m; j++)
        if (a[i][j] != a[h - i - 1][j]) goto E;
    h = h / 2;
  }
E:
  printf("%d", h);
  return 0;
}
