#include using namespace std; typedef ostringstream OSS; typedef istringstream ISS; typedef long long LL; typedef pair PII; typedef vector VI; typedef vector VVI; typedef vector VLL; typedef vector VVLL; typedef vector VD; typedef vector VVD; typedef vector VS; typedef vector VVS; typedef vector VB; typedef vector VVB; typedef vector VPII; #define fst first #define snd second // #define Y first // #define X second #define MP make_pair #define PB push_back #define EB emplace_back #define ALL(x) (x).begin(),(x).end() #define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY)) #define DUMP( x ) cerr << #x << " = " << ( x ) << endl #define rep(i, N) for (int i = 0; i < (int)(N); i++) #define REP(i, init, N) for (int i = (init); i < (int)(N); i++) template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; }; template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); }; const int INF = 0x3f3f3f3f; const LL INFL = 0x3f3f3f3f3f3f3f3fLL; const double DINF = 0x3f3f3f3f; const int DX[]={1,0,-1,0},DY[]={0,-1,0,1}; const double EPS = 1e-12; //const double PI = acos(-1.0); double add(double a, double b) { return ( abs(a + b) < EPS * (abs(a) + abs(b)) ) ? 0 : (a + b); } bool eq(double a, double b) { return abs(a - b) < EPS; } struct P { double x, y; P() {}; P(double x_, double y_) : x(x_), y(y_) {} P operator + (P p) { return P(add(x, p.x), add(y, p.y)); } P operator - (P p) { return P(add(x, -p.x), add(y, -p.y)); } P operator * (double d) { return P(x * d, y * d); } P operator / (double d) { return P(x / d, y / d); } bool eq(P p) { return ::eq(x, p.x) && ::eq(y, p.y); } // 内積 double dot(P p) { return add(x * p.x, y * p.y); } // 外積 double det(P p) { return add(x * p.y, -y * p.x); } }; // 線分上に点があるか bool on_seg(P p1, P p2, P q) { return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0; } // 直線と直線の交点 P intersection(P p1, P p2, P q1, P q2) { return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1)); } bool linestrx(vector

&ps) { rep(i, ps.size()) { if (!eq(ps[i].x, ps[(i + 1) % (int)ps.size()].x)) { return false; } } return true; } bool linestry(vector

&ps) { rep(i, ps.size()) { if (!eq(ps[i].y, ps[(i + 1) % (int)ps.size()].y)) { return false; } } return true; } bool linestr(P p1, P p2, P q1, P q2) { vector

ps = {p1, p2, q1, q2}; return linestrx(ps) || linestry(ps); } // 直線pと線分qが重なっているか bool is_cross(P p1, P p2, P q1, P q2) { if (linestr(p1, p2, q1, q2)) return true; P a = intersection(p1, p2, q1, q2); return on_seg(q1, q2, a); } typedef pair Line; int main(void) { int N; cin >> N; vector ls(N); for (auto &l : ls) { cin >> l.fst.x >> l.fst.y >> l.snd.x >> l.snd.y; } int res = 1; rep(i, N) rep(j, N) { rep(p, 2) rep(q, 2) { Line l; l.fst = p ? ls[i].fst : ls[i].snd; l.snd = q ? ls[j].fst : ls[j].snd; int cnt = 0; rep(k, N) { cnt += is_cross(l.fst, l.snd, ls[k].fst, ls[k].snd); } // cout << cnt << endl; res = max(res, cnt); } } cout << res << endl; return 0; }