#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[128][128];
bool p;
int main() {
  scanf("%d%d", &n, &m);
  p = true;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  while ((n & 1) == 0) {
    int f = 0;
    for (int i = 0; i < n / 2 && f == 0; i++)
      for (int j = 0; j < m && f == 0; j++)
        if (a[i][j] != a[n - i - 1][j]) f = 1;
    if (f == 0)
      n /= 2;
    else
      break;
  }
  printf("%d\n", n);
  scanf("%d", &n);
  return 0;
}
