import java.awt.*; import java.awt.geom.*; import java.io.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; int[] c = new int[n]; int[] d = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt(); d[i] = sc.nextInt(); } int max = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i == j)continue; int ax = a[i]; int bx = b[i]; int cx = c[j]; int dx = d[j]; Line2D xL = new Line2D.Double(ax,bx,cx,dx); Line2D xLB = new Line2D.Double(cx,dx,ax,bx); int ay = a[j]; int by = b[j]; int cy = c[i]; int dy = d[i]; Line2D yL = new Line2D.Double(ay,by,cy,dy); Line2D yLB = new Line2D.Double(cy,dy,ay,by); int xSumA = 0; int ySumA = 0; int xSumB = 0; int ySumB = 0; int xSumAB = 0; int ySumAB = 0; int xSumBB = 0; int ySumBB = 0; int xSumA2 = 0; int ySumA2 = 0; int xSumB2 = 0; int ySumB2 = 0; int xSumAB2 = 0; int ySumAB2 = 0; int xSumBB2 = 0; int ySumBB2 = 0; for(int k = 0; k < n; k++) { if(k == i || k == j) continue; Line2D target = new Line2D.Double(a[k],b[k],c[k],d[k]); Line2D target2 = new Line2D.Double(c[k],d[k],a[k],b[k]); if(target.intersectsLine(xL)) xSumA++; if(target.intersectsLine(yL)) ySumA++; if(xL.intersectsLine(target)) xSumB++; if(yL.intersectsLine(target)) ySumB++; if(target.intersectsLine(xLB)) xSumAB++; if(target.intersectsLine(yLB)) ySumAB++; if(xLB.intersectsLine(target)) xSumBB++; if(yLB.intersectsLine(target)) ySumBB++; if(target2.intersectsLine(xL)) xSumA2++; if(target2.intersectsLine(yL)) ySumA2++; if(xL.intersectsLine(target2)) xSumB2++; if(yL.intersectsLine(target2)) ySumB2++; if(target2.intersectsLine(xLB)) xSumAB2++; if(target2.intersectsLine(yLB)) ySumAB2++; if(xLB.intersectsLine(target2)) xSumBB2++; if(yLB.intersectsLine(target2)) ySumBB2++; } max = Math.max(xSumA+2, max); max = Math.max(ySumA+2, max); max = Math.max(xSumB+2, max); max = Math.max(ySumB+2, max); max = Math.max(xSumAB+2, max); max = Math.max(ySumAB+2, max); max = Math.max(xSumBB+2, max); max = Math.max(ySumBB+2, max); max = Math.max(xSumA2+2, max); max = Math.max(ySumA2+2, max); max = Math.max(xSumB2+2, max); max = Math.max(ySumB2+2, max); max = Math.max(xSumAB2+2, max); max = Math.max(ySumAB2+2, max); max = Math.max(xSumBB2+2, max); max = Math.max(ySumBB2+2, max); } } System.out.println(max); } }