#include <bits/stdc++.h>
using namespace std;
int n, m, ary[110][110], flag;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> ary[i][j];
  if (n & 1) {
    cout << n << "\n";
    return 0;
  }
  while (n != 1) {
    for (int i = 0; i < n / 2; i++)
      for (int j = 0; j < m; j++)
        if (ary[i][j] != ary[n - i - 1][j]) flag = 1;
    if (flag == 1) {
      cout << n << "\n";
      return 0;
    }
    n >>= 1;
    if (n & 1) {
      cout << n << "\n";
      return 0;
    }
  }
  cout << n << "\n";
  return 0;
}
