#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
int a[MAXN][MAXN];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  int ans = n;
  while (ans % 2 == 0) {
    int flg = 0;
    for (int i = 1; i <= ans / 2; i++)
      for (int j = 1; j <= m; j++)
        if (a[i][j] != a[ans - i + 1][j]) flg = 1;
    if (flg == 1) break;
    ans /= 2;
  }
  cout << ans << endl;
}
