#define _CRT_SECURE_NO_WARNINGS //#define _GLIBCXX_DEBUG #include using namespace std; typedef long long ll; //#define int ll //#define endl "\n" typedef vector vi; typedef vector vvi; typedef pair pii; #define all(c) (c).begin(), (c).end() #define loop(i,a,b) for(ll i=a; i ostream & operator<<(ostream & os, vector const &); template typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple const &){} template typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple const & t){ os << (n==0?"":" ") << get(t); _ot(os, t); } template ostream & operator<<(ostream & os, tuple const & t){ _ot<0>(os, t); return os; } template ostream & operator<<(ostream & os, pair const & p){ return os << "(" << p.first << ", " << p.second << ") "; } template ostream & operator<<(ostream & os, vector const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; } template inline bool chmax(T & x, T const & y){ return x inline bool chmin(T & x, T const & y){ return x>y ? x=y,true : false; } #ifdef DEBUG #define dump(...) (cerr<<#__VA_ARGS__<<" = "< Point; #define x real() #define y imag() #define CR const & #define EPS (1e-10) #define EQ(a,b) (abs(a-b) < EPS) #define LE(a,b) (EQ(a,b) || a < b) #define GE(a,b) (EQ(a,b) || b < a) struct Segment { Point p[2]; Segment (Point a = Point(), Point b = Point()){ p[0] = a, p[1] = b; } Point & operator [] (int k) { return p[k]; } Point const & operator [] (int k) const { return p[k]; } }; struct Line { Point p[2]; Line (Point a = Point(), Point b = Point()){ p[0] = a, p[1] = b; } Point & operator [] (int k) { return p[k]; } Point const & operator [] (int k) const { return p[k]; } }; Real dot(Point a, Point b){ return a.x*b.x + a.y*b.y; } Real cross(Point a, Point b){ return a.x*b.y - a.y*b.x; } bool comp_x(Point CR p, Point CR q){ return !EQ(p.x,q.x) ? p.x < q.x : p.y < q.y; } bool comp_y(Point CR p, Point CR q){ return !EQ(p.y,q.y) ? p.y < q.y : p.x < q.x; } namespace std { bool operator < (Point CR a, Point CR b){ return comp_x(a,b); } } enum { LEFT = 1, RIGHT = -1, BACK = 2, FRONT = -2, ON = 0 }; int ccw(Point p, Point q, Point r){ Point a = q-p, b = r-p; if(cross(a,b) > EPS) return LEFT; if(cross(a,b) < -EPS) return RIGHT; if(dot(a,b) < -EPS) return BACK; if(norm(a) < norm(b)) return FRONT; return ON; } bool iLS(Line const & l, Segment const & s){ int a = ccw(l[0], l[1], s[0]); int b = ccw(l[0], l[1], s[1]); // neither LEFT-LEFT nor RIGHT-RIGHT return abs(a*b) != 1; } signed main(){ int n; cin >> n; vector ss(n); vector ps(n*2); int X,Y; rep(i,n){ cin >> X >> Y; ss[i][0] = Point(X,Y); cin >> X >> Y; ss[i][1] = Point(X,Y); ps[i*2] = ss[i][0]; ps[i*2+1] = ss[i][1]; } int ans = 0; sort(all(ps)); ps.erase(unique(all(ps)), ps.end()); rep(i,ps.size())rep(j,i){ Line l(ps[i],ps[j]); int cnt = 0; rep(i,n) cnt += iLS(l,ss[i]); ans = max(ans, cnt); } cout << ans << endl; }