#include <bits/stdc++.h>
int num[111][111];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int i, k;
  for (i = 0; i < n; i++)
    for (k = 0; k < m; k++) scanf("%d", &num[i][k]);
  int ans = n;
  if (n % 2)
    printf("%d\n", n);
  else {
    int tn = n;
    while (1) {
      int tf = 1;
      for (i = 0; i < tn / 2; i++)
        for (k = 0; k < m; k++)
          if (num[i][k] != num[tn - 1 - i][k]) tf = 0;
      if (tf) {
        if (tn % 2) break;
        tn /= 2;
      } else {
        break;
      }
    }
    printf("%d\n", tn);
  }
  return 0;
}
