#include<iostream>
#include<vector>

using namespace std;

const int MAX = 101;

class UnionFind{
public:
  int par[MAX],rank[MAX];

  void init(int n){
    for(int i = 0; i < n; i++){
      par[i] = i;
      rank[i] = 0;
    }
  }
  
  int find(int x){
    if(par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    
    if(x == y) return;
    
    if(rank[x] < rank[y]) par[x] = y;
    else{
      par[y] = x;
      if(rank[x] == rank[y]) rank[x]++;
    }
  }

  bool same(int x, int y){
    return find(x) == find(y);
  }
};

struct Point{
  int n;
  double x,y;
  Point(){}
  Point(double x, double y):x(x),y(y){}
  void setNum(int num){n = num;}
  bool isSame(const Point& P) const {
    return (P.x-x)*(P.x-x)+(P.y-y)*(P.y-y) < 4.0;
  }
};

vector<Point> V;
int n;

void init(){
  V.clear();
}

void input(){
  V.resize(n);
  char c;
  for(int i = 0; i < n; i++){
    cin >> V[i].x >> c >> V[i].y;
    V[i].setNum(i);
  }
}

void solve(){
  UnionFind T;
  T.init(n);

  vector<Point> root;

  for(int i = 0; i < (int)V.size(); i++)
    for(int j = 0; j < (int)V.size(); j++)
      if(V[j].isSame(V[i])) T.unite(i,j);


  int S[MAX] = {0};

  for(int i = 0; i < (int)V.size(); i++){
    S[T.find(V[i].n)]++;
  }
  
  int ans = 0;

  for(int i = 0; i < MAX; i++)
    ans = max(ans,S[i]);

  cout << ans+1 << endl;
}

int main(){
  
  while(cin >> n && n){
    init();
    input();
    solve();
  }
  return 0;
}