#include <bits/stdc++.h>
using namespace std;
int mat[105][105];
int n, m, res;
void solve(int p) {
  if (p % 2) return;
  for (int i = 0, j = p - 1; i < p / 2; i++, j--)
    for (int k = 0; k < m; k++)
      if (mat[i][k] != mat[j][k]) return;
  res = res / 2;
  solve(p / 2);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%d", &mat[i][j]);
  res = n;
  solve(n);
  printf("%d\n", res);
  return 0;
}
