#include <bits/stdc++.h>
using namespace std;
int n, m, i, k, p;
string a[1000];
int main() {
  cin >> n >> m;
  p = true;
  for (i = 0; i <= n; i++) {
    getline(cin, a[i]);
  }
  while (n % 2 == 0) {
    k = n;
    for (i = 1; i <= n / 2; i++) {
      if (a[i] == a[k])
        k--;
      else {
        p = false;
        break;
      }
    }
    if (p == false) break;
    n = n / 2;
  }
  cout << n;
}
