#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
long long n, k, i, a, b, j, ans;
int p[200][200];
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= k; j++) {
      cin >> p[i][j];
    }
  }
  while (n % 2 == 0 && n != 0) {
    for (i = 1; i <= n / 2; i++) {
      for (j = 1; j <= k; j++) {
        if (p[i][j] != p[n + 1 - i][j]) {
          cout << n;
          return 0;
        }
      }
    }
    n = n / 2;
  }
  cout << n;
}
