#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  int m = 0;
  cin >> n >> m;
  vector<vector<int>> matrix(n, vector<int>(m));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> matrix[i][j];
    }
  }
  int poss = 0;
  while (true) {
    if (n % 2 == 1) {
      cout << n;
      return 0;
    }
    bool flag = true;
    for (int i = 0; i < n / 2; ++i) {
      for (int j = 0; j < m; ++j) {
        if (matrix[i][j] != matrix[n - i - 1][j]) {
          flag = false;
        }
      }
    }
    if (!flag) {
      cout << n;
      return 0;
    } else {
      n = n / 2;
      poss++;
    }
  }
  return 0;
}
