#include <bits/stdc++.h>
using namespace std;
string R[110];
bool check(int r1, int r2) {
  int len = r2 - r1 + 1;
  len /= 2;
  int cnt = len;
  int i = len;
  int j = len + 1;
  while (cnt--) {
    if (R[i] != R[j])
      return false;
    else {
      i--;
      j++;
    }
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  string line;
  stringstream ss;
  getline(cin, line);
  ss << line;
  int n, m, i;
  ss >> n >> m;
  for (i = 1; i <= n; ++i) getline(cin, R[i]);
  int res = n;
  while (res % 2 == 0) {
    if (check(1, res)) {
      res /= 2;
    } else {
      break;
    }
  }
  cout << res << endl;
  return 0;
}
