#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;

#define EPS (1.0e-6)
#define equals(a, b) (fabs((a)-(b)) < EPS)
#define N_MAX 100

struct Point {
  double x, y;
  Point(double x = 0, double y = 0) : x(x), y(y) {}
  Point operator +(Point p) { return Point(x + p.x, y + p.y); }
  Point operator -(Point p) { return Point(x - p.x, y - p.y); }
  Point operator *(double a) { return Point(x * a, y * a); }
  Point operator /(double a) { return Point(x / a, y / a); }
  bool operator < (const Point &p) const {
    return x != p.x ? p.x - x > EPS : p.y - y > EPS;
  }
  bool operator == (const Point &p) const {
    return equals(x, p.x) && equals(y, p.y);
  }
  bool operator != (const Point &p) const {
    return !(*this == p);
  }
};
typedef Point Vector;

struct Segment {
  Point p1, p2;
  Segment(Point p1, Point p2) {
    this->p1 = p1;
    this->p2 = p2;
  }
};
typedef Segment Line;

double norm(Vector a) { return pow(a.x, 2.0) + pow(a.y, 2.0); }
double abs(Vector a) { return sqrt(norm(a)); }
double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }
bool isParallel(Vector a, Vector b) {
  return equals(cross(a, b), 0.0);
}
bool isParallel(Line s1, Line s2) {
  return isParallel(s1.p2 - s1.p1, s2.p2 - s2.p1);
}
Point getCrossPoint(Line s1, Line s2) {
  Vector a = s1.p2 - s1.p1;
  Vector b = s2.p2 - s2.p1;
  double d1 = cross(b, a);
  double d2 = cross(b, s2.p1 - s1.p1);
  return s1.p1 + a*d2/d1;
}
Vector getOrthogonal(Vector a) { return Vector(-a.y, a.x); }

int N;
Point P[N_MAX];

void make(int k, vector<Point> &V) {
  vector<Line> L;
  for(int j = 0; j < N; ++j) {
    if(j == k) continue;
    if(abs(P[k] - P[j]) <= 2.0) {
      Point m = (P[k]+P[j])/2.0;
      L.push_back(Line(P[k], P[j]));
      L.push_back(Line(m, m+getOrthogonal(P[k]-P[j])));
    }
  }
  for(int i = 0; i < L.size(); ++i) {
    for(int j = i+1; j < L.size(); ++j) {
      if(!isParallel(L[i], L[j]))
	V.push_back(getCrossPoint(L[i], L[j]));
    }
  }
}

void solve() {
  vector<Point> V;
  for(int i = 0; i < N; ++i) {
    make(i, V);
  }
  V.erase(unique(V.begin(), V.end()), V.end());
  int ans = 1;
  for(int i = 0; i < V.size(); ++i) {
    int cnt = 0;
    for(int j = 0; j < N; ++j) {
      if(abs(V[i] - P[j]) <= 1.0) cnt++;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}


int main() {
  while((cin >> N) && N) {
    for(int i = 0; i < N; ++i) {
      scanf("%lf,%lf", &P[i].x, &P[i].y);
    }
    solve();
  }
}