#include <bits/stdc++.h>
using namespace std;
int n, m, i, j;
int sym(int a[][100], int n, int m) {
  bool ok = true;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] != a[n - i - 1][j]) return 0;
  return (n % 2 == 0);
}
int main() {
  cin >> n >> m;
  int a[n][100];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) cin >> a[i][j];
  while (sym(a, n, m) && n != 1) n /= 2;
  cout << n << endl;
  return 0;
}
