#include <bits/stdc++.h>
using namespace std;
struct data {
  double x, y;
  data(double a, double b) : x(a), y(b) {}
  data() {}
};
double dis(data a, data b) {
  double latte1 = a.x - b.x, latte2 = a.y - b.y;
  return sqrt(latte1 * latte1 + latte2 * latte2);
}
int main() {
  int n;
  while (cin >> n, n) {
    vector<data> V(n);
    int Max = 0;
    for (int i = 0; i < n; i++) (cin >> V[i].x).ignore() >> V[i].y;
    for (int i = 0; i < n; i++) {
      int cnt = 0;
      for (int j = 0; j < n; j++) {
        if (dis(V[i], V[j]) - 2 < 0.00001) cnt++;
      }
      Max = max(Max, cnt);
    }
    cout << Max << endl;
  }
}
