#include <bits/stdc++.h>
using namespace std;
double solve(pair<double, double> a, pair<double, double> b) {
  double x = (a.first - b.first);
  x = x * x;
  double y = (a.second - b.second);
  y = y * y;
  return sqrt(x + y);
}
int main() {
  char ch;
  int n;
  while (cin >> n) {
    if (n == 0) break;
    pair<double, double> data[100];
    for (int i = 0; i < (n); i++) {
      cin >> data[i].first >> ch >> data[i].second;
    }
    int maxi = 0;
    for (int i = 0; i < (n); i++) {
      int c = 0;
      for (int j = 0; j < (n); j++) {
        if (solve(data[i], data[j]) <= 2) c++;
      }
      maxi = max(maxi, c);
    }
    cout << maxi << endl;
  }
}
