#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[102][102];
  int b, c, i, j, n, m;
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> a[i][j];
  b = n;
  while (b % 2 == 0 && b / 2 != 0) {
    c = 0;
    for (i = 1; i <= b / 2; i++)
      for (j = 1; j <= m; j++)
        if (a[i][j] != a[b - i + 1][j]) c = 1;
    if (c == 1) break;
    b = b / 2;
  }
  printf("%d\n", b);
  return 0;
}
