#include<complex>
#include<cmath>
#include<iostream>
#include<cstdio>
#define EPF 1e-10
using namespace std;

typedef complex<double> P;

int main(){
  int n,ans;
  double x,y;
  while(cin >> n && n){
    P inf[n];
    ans = 1;
    for(int i=0;i<n;i++){
      scanf("%lf,%lf",&x,&y);
      inf[i] = P(x,y);
    }

    int cnt;
    for(int i=0;i<n;i++){
      cnt = 0;
      for(int j=0;j<n;j++){
	if(abs(inf[i]-inf[j]) <= 2.0+EPF)cnt++;
      }
      ans = max(ans,cnt);
    }
    cout << ans << endl;
  }
  return 0;
}