#include <bits/stdc++.h>
using namespace std;
int mat[110][110];
int n, m;
int judge(int row) {
  if (row % 2) return row;
  bool ret = true;
  for (int i = 0; i < row / 2 && ret; i++) {
    for (int j = 0; j < m; j++) {
      if (mat[i][j] != mat[row - 1 - i][j]) {
        ret = false;
        break;
      }
    }
  }
  if (ret) return judge(row / 2);
  return row;
}
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]);
    }
  }
  cout << judge(n) << endl;
  return 0;
}
