https://www.acmicpc.net/problem/17386
def ccw(v1,w1,v2,w2,v3,w3):
return (v1*w2+v2*w3+v3*w1)-(v2*w1+v3*w2+v1*w3)
x1,y1,x2,y2=map(int,input().split())
x3,y3,x4,y4=map(int,input().split())
a1=ccw(x1,y1,x2,y2,x3,y3)*ccw(x1,y1,x2,y2,x4,y4)
a2=ccw(x3,y3,x4,y4,x1,y1)*ccw(x3,y3,x4,y4,x2,y2)
if a1<0 and a2<0: print("1")
else: print("0")