#include <bits/stdc++.h>
using namespace std;
int num[105][105];
int row, col;
bool check(int cur) {
  if (cur % 2 == 1) return false;
  for (int i = 0; i < cur / 2; ++i)
    for (int j = 0; j < col; ++j)
      if (num[i][j] != num[cur - 1 - i][j]) return false;
  return true;
}
int main() {
  cin >> row >> col;
  for (int i = 0; i < row; ++i)
    for (int j = 0; j < col; ++j) cin >> num[i][j];
  int ans = row;
  while (check(row)) {
    ans = row / 2;
    row /= 2;
  }
  cout << ans << endl;
}
