#include <bits/stdc++.h>
using namespace std;
complex<double> A[100], j = sqrt(-1);
double a, b, d;
int n;
int f(int m, complex<double> p, complex<double> p1) {
  int i, s1 = 2, s2 = 2;
  complex<double> p3 = polar(1.0, b + d) + p, p4 = polar(1.0, b - d) + p, q;
  for (i = 0; i < n; i++) {
    q = A[i];
    if (q == p || q == p1) continue;
    if (abs(q - p3) - 1 < 1e-6) s1++;
    if (abs(q - p4) - 1 < 1e-6) s2++;
  }
  if (m < s1) m = s1;
  if (m < s2) m = s2;
  return m;
}
int main() {
  int m, i, i1;
  char c;
  while (cin >> n, n != 0) {
    for (i = 0; i < n; i++) {
      cin >> a >> c >> b;
      A[i] = complex<double>(a, b);
    }
    m = 1;
    for (i = 0; i < n; i++) {
      complex<double> p = A[i], q;
      for (i1 = i + 1; i1 < n; i1++) {
        q = A[i1];
        a = abs(q - p);
        b = arg(q - p);
        d = acos(a / 2);
        if (a <= 2) m = f(m, p, q);
      }
    }
    cout << m << endl;
  }
}
