#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int main() {
  int x, y;
  while (~scanf("%d%d", &x, &y)) {
    for (int i = 0; i < x; i++) {
      for (int j = 0; j < y; j++) {
        scanf("%d", &a[i][j]);
      }
    }
    if (x % 2)
      printf("%d\n", x);
    else {
      int ok = 1;
      while (ok) {
        x = x / 2;
        for (int i = x - 1, j = x; i >= 0; j++, i--) {
          for (int k = 0; k < y; k++) {
            if (a[i][k] != a[j][k]) {
              ok = 0;
              break;
            }
            if (!ok) break;
          }
        }
        if (x % 2 == 1 && ok) {
          printf("%d\n", x);
          break;
        }
      }
      if (!ok) printf("%d\n", x * 2);
    }
  }
  return 0;
}
