#include <bits/stdc++.h>
using namespace std;
const int N = 105;
string s[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int arr;
      cin >> arr;
      s[i] += (arr + '0');
    }
  }
  int v = n - 1;
  while (true) {
    bool flag = 0;
    if (n % 2) {
      cout << n << endl;
      break;
    }
    for (int i = 0; i < n / 2; i++, v--) {
      if (s[i] != s[v]) flag = 1;
    }
    if (flag) {
      cout << n << endl;
      break;
    }
    n /= 2;
  }
}
