#include <bits/stdc++.h>
using namespace std;
int mat[110][110];
int n, m;
int solve(int a) {
  for (int i = 0; i < a / 2; ++i) {
    for (int j = 0; j < m; ++j)
      if (mat[i][j] != mat[a - i - 1][j]) return 0;
  }
  return 1;
}
int main() {
  while (cin >> n >> m) {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) cin >> mat[i][j];
    int res = n;
    for (; res > 0; res /= 2) {
      if (res % 2 == 0) {
        if (!solve(res)) break;
      } else {
        break;
      }
    }
    cout << res << endl;
  }
}
