#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
int n;
int dfs(int searched,vector<int> seal, vector< set<int> > &over){
  int newseal = -1;
  FOR(i,searched,n){
    if(find(seal.begin(),seal.end(),i)!=seal.end()) continue;
    bool ok = true;
    REP(j,seal.size()){
      if(over[seal[j]].find(i)==over[seal[j]].end()){
        ok = false;
        break;
      }
    }
    if(ok){
      newseal = i;
      break;
    }
  }
  int ret;
  if(newseal==-1){
    ret =  seal.size();
  }else{
    vector<int> nextseal = seal;
    nextseal.push_back(newseal);
    ret = dfs(newseal+1,nextseal,over);
    ret = max(ret,dfs(newseal+1,seal,over));
  }
  return ret;
}
int main(void){
  while(cin>>n){
    if(n==0) break;
    double x[100],y[100];
    double d[100][100];
    vector< set<int> > overlap(n);
    REP(i,n)REP(j,n) d[i][j] = 100.0;
    REP(i,n){
      scanf("%lf,%lf",x+i,y+i);
    }
    REP(i,n)FOR(j,i+1,n){
      double dist = sqrt( (x[j]-x[i])*(x[j]-x[i]) + (y[j]-y[i])*(y[j]-y[i]) );
      if(dist<2+EPS){
        overlap[i].insert(j);
        overlap[j].insert(i);
      }
    }
    cout<<dfs(0,vector<int>(),overlap)<<endl;
  }
  return 0;
}