#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define MAX 102 const double EPS = 0.0; struct st{ double a; double b; double c; double d; st(){ cin >> a >> b >> c >> d; } }; vector v; vector > g; int n; double func(double a, double b, double x){ return a*x + b; } bool inclu(double a, double b, double c, double d){ if (b < c || d < a){ return false; } return true; } pair calc(double a, double b, double c, double d){ double k = d - b; k /= (c - a); double N = k*-a; N += b; return make_pair(k, N); } int main(){ scanf("%d", &n); if (n == 1){ puts("1"); return 0; } for (int i = 0; i < n; i++){ v.push_back(st()); } for (int i = 0; i < v.size(); i++){ g.push_back(make_pair(v[i].a, v[i].b)); g.push_back(make_pair(v[i].c, v[i].d)); } sort(g.begin(), g.end()); g.erase(unique(g.begin(), g.end()), g.end()); int maxt = 0; for (int i = 0; i < g.size(); i++){ for (int j = i + 1; j < g.size(); j++){ if (g[i].first == g[j].first){ int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (min(v[ii].c, v[ii].a) <= g[i].first&&g[i].first <= max(v[ii].a, v[ii].c)){ countt++; } } maxt = max(maxt, countt); continue; } if (g[i].second == g[j].second){ int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (min(v[ii].b, v[ii].d) <= g[i].second&&g[i].second <= max(v[ii].b, v[ii].d)){ countt++; } } maxt = max(maxt, countt); continue; } double k = g[j].second - g[i].second; double s = g[j].first - g[i].first; k /= s; double N = k*-g[j].first; N += g[j].second; //y=kX+N int countt = 0; for (int ii = 0; ii < v.size(); ii++){ if (v[ii].a == v[ii].c){ double x1 = func(k, N, v[ii].a); if (min(v[ii].b, v[ii].d) <= x1&&x1 <= max(v[ii].b, v[ii].d)){ countt++; } } else{ double node_k = calc(v[ii].a, v[ii].b, v[ii].c, v[ii].d).first; double node_n = calc(v[ii].a, v[ii].b, v[ii].c, v[ii].d).second; //node_kX+node_n=kX+n //node_kX-kX=n-node_n double lef = node_k - k; double rig = N - node_n; rig /= lef; //x=rig double x = rig; double y = func(node_k, node_n, x); if (v[ii].b == v[ii].d){ double xx = func(k, N, v[ii].a); double yy = func(k, N, v[ii].c); if (xx > yy){ swap(xx, yy); } if (xx <= v[ii].b&v[ii].b <= yy){ countt++; } continue; } if ((min(v[ii].b, v[ii].d)-EPS <= y&&y <= max(v[ii].b, v[ii].d))+EPS || (min(v[ii].a, v[ii].c)-EPS <= x&&x <= max(v[ii].a, v[ii].c)+EPS)){ countt++; } } } maxt = max(maxt, countt); } } cout << maxt << endl; return 0; }