#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans;
  double x, y;
  while (cin >> n && n) {
    complex<double> inf[n];
    ans = 1;
    for (int i = 0; i < n; i++) {
      scanf("%lf,%lf", &x, &y);
      inf[i] = complex<double>(x, y);
    }
    int cnt;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        if (abs(inf[i] - inf[j]) >= 2.0 + 1e-10) continue;
        double MD = sqrt(1 - 0.25 * norm(inf[i] - inf[j]));
        complex<double> mid = (inf[i] + inf[j]) * 0.5;
        complex<double> p1 =
            mid + mid / norm(mid) * polar(MD, 3.14159265358979323846264338 / 2);
        complex<double> p2 =
            mid +
            mid / norm(mid) * polar(MD, -3.14159265358979323846264338 / 2);
        cnt = 0;
        for (int k = 0; k < n; k++) {
          if (abs(p1 - inf[k]) < 1e-10 + 1.0) cnt++;
        }
        ans = max(ans, cnt);
        cnt = 0;
        for (int k = 0; k < n; k++)
          if (abs(p2 - inf[k]) < 1e-10 + 1.0) cnt++;
        ans = ans < cnt ? cnt : ans;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
