Connect the countless points with lines, till we reach the faraway yonder.

There are n points on a coordinate plane, the i-th of which being (i, y_{i}).

Determine whether it's possible to draw two parallel and non-overlapping lines, such that every point in the set lies on exactly one of them, and each of them passes through at least one point in the set.


-----Input-----

The first line of input contains a positive integer n (3 ≤ n ≤ 1 000) — the number of points.

The second line contains n space-separated integers y_1, y_2, ..., y_{n} ( - 10^9 ≤ y_{i} ≤ 10^9) — the vertical coordinates of each point.


-----Output-----

Output "Yes" (without quotes) if it's possible to fulfill the requirements, and "No" otherwise.

You can print each letter in any case (upper or lower).


-----Examples-----
Input
5
7 5 8 6 9

Output
Yes

Input
5
-1 -2 0 0 -5

Output
No

Input
5
5 4 3 2 1

Output
No

Input
5
1000000000 0 0 0 0

Output
Yes



-----Note-----

In the first example, there are five points: (1, 7), (2, 5), (3, 8), (4, 6) and (5, 9). It's possible to draw a line that passes through points 1, 3, 5, and another one that passes through points 2, 4 and is parallel to the first one.

In the second example, while it's possible to draw two lines that cover all points, they cannot be made parallel.

In the third example, it's impossible to satisfy both requirements at the same time.

Difficulty: interview

Starter code:

Solutions:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    if a[1] - a[0] == a[2] - a[1]:
        d = a[1] - a[0]
        c1 = a[0]
        c2 = 'no'
        for i in range(3, n):
            if i * d + c1 == a[i]:
                pass
            elif c2 == 'no':
                c2 = a[i] - d * i
            elif i * d + c2 == a[i]:
                pass
            else:
                print('No')
                return
        if c2 == 'no':
            print('No')
        else:
            print('Yes')
        return
    else:
        f = True
        d = a[1] - a[0]
        c1 = a[0]
        c2 = a[2] - 2 * d
        #print(d, c1, c2)
        for i in range(3, n):
            if (a[i] == i * d + c1) or (a[i] == i * d + c2):
                pass
            else:
                f = False
                break
        if f:
            print('Yes')
            return
        f = True
        d = a[2] - a[1]
        c1 = a[1] - d
        c2 = a[0]
        #print(d, c1, c2)
        for i in range(3, n):
            if (a[i] == i * d + c1) or (a[i] == i * d + c2):
                pass
            else:
                f = False
                break
        if f:
            print('Yes')
            return
        f = True
        d = (a[2] - a[0]) / 2
        c1 = a[0]
        c2 = a[1] - d
        #print(d, c1, c2)
        for i in range(3, n):
            #print(a[i], i * d + c1, i * d + c2)
            if (a[i] == i * d + c1) or (a[i] == i * d + c2):
                pass
            else:
                f = False
                break
        if f:
            print('Yes')
        else:
            print('No')

main()


n=int(input())
a=list(map(int,input().split()))
anss =0 
for i in range (1,n):
    ans = 0
    k = -1
    m = -1
    j = 1
    while (k == -1 and j< n ):
        if (i*(a[j]-a[0])!=j*(a[i]-a[0])):
            k= j
        j=j+1
    while ( j<n and m ==-1):
        if (i*(a[j]-a[0])!=j*(a[i]-a[0])):
            if (i*(a[j]-a[k])!=(j-k)*(a[i]-a[0])):
                m = 1
        j=j+1
    if (m == -1 and k!= -1):
        anss = 1
if (anss == 1):
    print("Yes")
else:
    i=0
    if ((i-1)*(a[2]-a[1])!=a[i]-a[1]):
        anss = 1
    for i in range(3,n):
        if ((i-1)*(a[2]-a[1])!=a[i]-a[1]):
            anss = -1
    if (anss == 1):
        print("Yes")
    else:
        print("No")
            
        
        


import sys


def main():
    n = int(input())
    s = list(map(int, sys.stdin.readline().split()))
    x = [i + 1 for i in range(n)]
    p1 = (0, 0)
    x0 = 0
    for z in range(2):
        for i in range(1, n):
            k = (s[i] - s[0]) / (x[i] - x[0])
            oka = True
            okp = False
            for j in range(1, n):
                if i == j:
                    continue
                c = (s[j] - s[0]) / (x[j] - x[0])
                if c != k:
                    if not okp:
                        p1 = (x[j], s[j])
                        okp = True
                    else:
                        k2 = (s[j] - p1[1]) / (x[j] - p1[0])
                        if k != k2:
                            oka = False
                            break

            if oka and okp:
                print("Yes")
                return
        s[1], s[0] = s[0], s[1]
        x[1], x[0] = x[0], x[1]

    print("No")


main()


def read_ints():
	return [int(i) for i in input().split()]

n = int(input())
p = [(i, int(k)) for i, k in enumerate(input().split())]

dist = set()
for i in range(1, n):
	dist.add(p[i][1] - p[i - 1][1])

if len(dist) == 1:
	print('No')
	return

dist = set()
for i in range(2, n):
	dist.add(p[i][1] - p[i - 1][1])

if len(dist) == 1:
	print('Yes')
	return

splited_pnt = dict()

for i in range(1, n):
	l = (p[i][1] - p[0][1]) / p[i][0]
	if l not in splited_pnt:
		splited_pnt[l] = []
	splited_pnt[l].append(i)

for l, pnt in splited_pnt.items():
	if len(p) - len(pnt) < 3:
		print('Yes')
		return

	other = [i for i in range(n) if i not in set(pnt + [0])]


	if all((p[i][1] - p[other[0]][1]) / (p[i][0] - p[other[0]][0]) == l for i in other[1:]):
		print('Yes')
		return

print('No')

N = int(input())
a = list(map(int, input().split()))
import sys
sys.setrecursionlimit(1500)

def solve(n, slope, d, slope2=None, d2 = 0, point=None):
	if n == N:
		if point is None:
			return False
		else:
			return True
	
	if a[n] == slope*n + d:
		return solve(n+1, slope, d, slope2, d2, point)
	else:
		if point is None:
			return solve(n+1, slope, d, slope2, d2, point=n)
		else:
			slope2 = (a[n] - a[point]) / (n - point)
			if slope2 != slope:
				return False
			d2 = a[point] - point*slope2
			return solve(n+1, slope, d, slope2, d2, point)

for i, j in [(0, 1), (1, 2), (0, 2)]:

	slope = (a[j] - a[i]) / (j - i)
	d = a[i] - i*slope
	if solve(0, slope, d):	
		print("Yes")
		break
else:
	print("No")
			
	


def f(m,c1,c2,l,n):
    fl=True
    for i in range(n):
        if (l[i]-(m1*i+m1)!=c1) and (l[i]-(m1*i+m1)!=c2):
            fl=False
            break
    return fl and c1!=c2
n=int(input())
l=list(map(int,input().split()))
m1=l[1]-l[0]
c1=l[0]-m1
c2=c1
for i in range(n):
    if l[i]-(m1*(i+1))!=c1:
        c2=l[i]-(m1*(i+1))
f1=f(m1,c1,c2,l,n)
m1=l[1]-l[0]
c1=l[0]-m1
c2=l[2]-m1*3
f2=f(m1,c1,c2,l,n)
m1=(l[2]-l[0])/2
c1=l[0]-m1
c2=l[1]-m1*2
f3=f(m1,c1,c2,l,n)
m1=l[2]-l[1]
c1=l[0]-m1
c2=l[1]-m1*2
f4=f(m1,c1,c2,l,n)
if f1 or f2 or f3 or f4:
    print("Yes")
else:
    print("No")



n = int(input())
y = list(map(int, input().split()))

def check(d):
    return len(set(2 * yi - d * i for i, yi in enumerate(y))) == 2 

s = 2*(y[1]-y[0]), 2*(y[2]-y[1]), y[2] - y[0]
print('Yes' if any(check(d) for d in s) else 'No')


#B
def is_belong(A, C, x, y):
    return A*x + y + C == 0

def solution():
    n = int(input())
    a = [int(i) for i in input().split()]

    #if n == 3:
    #    print('Yes')
    #    return
    
    other_pointes_indexes = []
    for k in [0, 1]:
        #зададим прямую по двум точкам
        for i in range(1, n):
                if k == i:
                    continue
                #использовала уравнение Ax + y + C = 0
                #A = (y2 - y1)/(x1 - x2)
                #C = -y1 - Ax1
                A = 0
                if k - i != 0:
                    A = (a[i] - a[k])/(k - i)
                C1 = -a[k] - A*k
                C2 = C1
                
                #проверяем принадлежность точек прямым
                success = True
                for j in range(n):
                    if not is_belong(A, C1, j, a[j]):
                        if C2 != C1:
                            if not is_belong(A, C2, j, a[j]):
                                success = False
                                break
                        else:
                            C2 = -A*j - a[j]
                if success:
                    if C1 != C2:
                        print('Yes')
                        return
            
    print('No')
    
solution()

n=int(input())
l=[int(i) for i in input().split()]
slope= (l[n-1]-l[0])/(n-1)
f=0
for j in range(1,n-1):
    if (((l[j]-l[0])/(j))!= slope):
        f=1
        break
if (f==0):
    print ('No')
else:
    flag=0
    for i in range(1,n-1):
        s= (l[i]-l[0])/i
        l1=[]
        for j in range(n):
            l1.append(0)
        l1[0]=1
        l1[i]=1
        l2=[]
        for j in range(i+1,n):
            if ((l[j]-l[0])/j ==s):
                l1[j]=1
        if (l1.count(0)==1):
            print ("Yes")
            flag=1
            break
        else:
            for j in range(n):
                if (l1[j]==0):
                    l2.append([l[j],j])
            length=len(l2)
            s1= (l2[-1][0]-l2[0][0])/(l2[-1][1]-l2[0][1])
            if (s1!=s):
                continue
            else:
                check=0
                for j in range(1,length-1):
                    if ( ((l2[j][0]-l2[0][0])/(l2[j][1]-l2[0][1]))!=s1 ):
                        check=1
                        break
                if (check==1):
                    continue
                else:
                    print ('Yes')
                    flag=1
                    break
    if (flag==0):
        if (n==3):
            print ('Yes')
            flag=1
        else:
            s= (l[-2]-l[1])/ (n-3)
            if (s==slope):
                check=0
                for i in range(2,n-2):
                    if ( ((l[i]-l[1])/(i-1))!=s):
                        check=1
                        break
                if (check==0):
                    print ('Yes')
                    flag=1
        if (flag==0):
            s= (l[-1]-l[1])/(n-2)
            check=0
            for i in range(2,n-1):
                if ( ((l[i]-l[1])/(i-1))!=s ):
                    check=1
                    break
            if (check==0):
                print ('Yes')
            else:
                print ('No')

n = input()
y = list(map(int, input().split()))

def chk(limit):
    return len(set(2 * yi - limit * i for i, yi in enumerate(y))) == 2

s = 2 * (y[1] - y[0]), 2  * (y[2] - y[1]), y[2] - y[0]

print('Yes' if any(chk(x) for x in s) else 'No')


def test(id1,id2,l,n):
	a = l[id1] - l[id2]
	b = id2 - id1
	c = ((id1)*l[id2]) - ((id2)*l[id1])
	d=[]
	for i in range(n):
		if a*i+b*l[i]+c!=0:
			d+=[i]
	if len(d)==0:return False
	if len(d)==1:return True

	aa = l[d[0]] - l[d[1]]
	bb = d[1] - d[0]
	cc = ((d[0])*l[d[1]]) - ((d[1])*l[d[0]])

	for i in range(len(d)):
		if aa*d[i]+bb*l[d[i]]+cc!=0:
			return False
	return (l[id1]-l[id2])/(id1-id2)==(l[d[1]]-l[d[0]])/(d[1]-d[0]) 	
n=int(input())
l=[int(i)for i in input().split()]
print("Yes"if test(0,1,l,n) or test(1,2,l,n) or test(0,2,l,n) else "No" )

from math import isclose

n = int(input())
y = [0] + list(map(int, input().split()))
ans = True
if n == 4:
    if (y[1] - y[3])/2 == (y[2] - y[4])/2 or \
       (y[1] - y[4])/3 == (y[2] - y[3]):
        print('Yes')
        return
catch = None
for z in [1, 2]:
    c = {}
    for i in range(z+1, len(y)):
        k = (y[i] - y[z])/(i - z)
        if k not in c:
            c[k] = 1
        else:
            catch = k
            break
    if catch != None:
        break
else:
    catch = (y[2] - y[1])

y_new = []

for i in range(2, len(y)):
    k = (y[i] - y[1])/(i - 1)
    if not isclose(k, catch):
        y_new.append((i, y[i]))
if not y_new:
    ans = False
elif len(y_new) == 1:
    ans = True
else:
    for i in range(1, len(y_new)):
        k = (y_new[0][1] - y_new[i][1])/(y_new[0][0] - y_new[i][0])
        if not isclose(catch, k):
            ans = False
            break

if ans:
    print('Yes')
else:
    print('No')
"""
6
2 -1 2 5 14 17
"""


n = input()
y = list(map(int, input().split()))


def chk(limit):
    return len(set(2 * yi - limit * i for i, yi in enumerate(y))) == 2


s = 2 * (y[1] - y[0]), 2 * (y[2] - y[1]), y[2] - y[0]

print('Yes' if any(chk(x) for x in s) else 'No')


from fractions import Fraction
from itertools import combinations

N = int(input())
YL = list(map(int, input().strip().split()))
YM = dict(enumerate(YL, start=1))


def get_b(k, x):
    y = YM[x]
    b = y - k*x
    return b


def extract(x1, x2):
    y1 = YM[x1]
    y2 = YM[x2]
    k = Fraction(y2-y1, x2-x1)
    b = get_b(k, x1)
    return k, b


def fits(k, b, x):
    return get_b(k, x) == b


def fits3(x1, x2, x):
    k, b = extract(x1, x2)
    return fits(k, b, x)


def getk5():
    k_count = {}
    num = min(5, N)
    for x1, x2 in combinations(list(range(1, num+1)), 2):
        k, _ = extract(x1, x2)
        k_count[k] = k_count.get(k, 0) + 1

    for k, count in list(k_count.items()):
        if count > 2:
            return k

    return None


def main():
    if N == 3:
        print('Yes' if not fits3(1, 2, 3) else 'No')
        return

    k = getk5()
    if k is None:
        if N == 4:
            x1 = 1
            for x2 in (2, 3, 4):
                k12, b12 = extract(x1, x2)
                x3, x4 = [x for x in (1, 2, 3, 4) if x != x1 and x != x2]
                k34, b34 = extract(x3, x4)
                if k12 == k34 and b12 != b34:
                    print('Yes')
                    return
                # else:
                #     print('** %s-%s, %s-%s: %s %s vs %s %s' % (
                #         (x1, YM[x1]), (x2, YM[x2]),
                #         (x3, YM[x3]), (x4, YM[x4]),
                #         k12, b12, k34, b34
                #     ))
            print('No')
            return

        print('No')
        return

    b_set = set()
    for x in range(1, N+1):
        b_set.add(get_b(k, x))
    print('Yes' if len(b_set) == 2 else 'No')

main()



n=int(input())
y=list(map(int,input().split()))
def check(d):
    return len(set(2*yi-d*i for i,yi in enumerate(y)))==2

print('Yes' if any(check(d) for d in [2*(y[1]-y[0]),2*(y[2]-y[1]),y[2]-y[0]]) else 'No')


n = int(input())
P = list(enumerate(map(int,input().split())))

from fractions import gcd


def check(i,j):
  x0,y0 = P[i]
  x1,y1 = P[j]

  dx = x1-x0
  dy = y1-y0
  offsets = [dx*y0-dy*x0]

  for x,y in P:
    o = dx*y-dy*x
    if o not in offsets:
      offsets.append(o)
      if len(offsets) > 2:
        return False

  return len(offsets) == 2
  
print('Yes' if any(check(i,j) for i,j in [(0,1),(1,2),(0,2)]) else 'No')

n = int(input())
yi = list(map(int, input().split()))

steps = yi[1] - yi[0], (yi[2] - yi[0])/2, yi[2] - yi[1]
if any(len(set(l)) == 2 for l in ((y - i * step for i, y in enumerate(yi)) for step in steps)):
    print('Yes')
else:
    print('No')



n = int(input())
yi = list(map(int, input().split()))

steps = yi[1] - yi[0], (yi[2] - yi[0])/2, yi[2] - yi[1]
if any(len(set(l)) == 2 for l in ([y - i * step for i, y in enumerate(yi)] for step in steps)):
    print('Yes')
else:
    print('No')



n = int(input())
yi = list(map(int, input().split()))

steps = yi[1] - yi[0], (yi[2] - yi[0])/2, yi[2] - yi[1]
if any(len(set(l)) == 2 for l in [[y - i * step for i, y in enumerate(yi)] for step in steps]):
    print('Yes')
else:
    print('No')



points = int(input())
y = list(map(int, input().split()))

def slope(p1, p2):
    return (p2[1] - p1[1])/(p2[0] - p1[0])

def passes(one, two, point):
    return 0 == (one[0] * (two[1] - point[1]) + two[0] * (point[1] - one[1]) + point[0] * (one[1] - two[1]))

def possible(start, joint, coords):
    others = list()

    for point in coords:
        if not passes(start, joint, point):        
            others.append(point)

    if len(others) == 0:
        return (False, others)

    elif len(others) == 1:
        return (True, others)

    elif len(others) >= 2:
        other1, other2 = others[0], others[1]

        for point in others:
            if not passes(other1, other2, point):
                return (False, others)

        if slope(other1, other2) == slope(start, joint):
            return (True, others)
        else:
            return (False, others)

coords = [(k+1, y[k]) for k in range(points)]
start = coords.pop(0)

poss, others = possible(start, coords[0], coords)
if (not poss) and len(others) > 0:
    poss |= possible(start, others[0], coords)[0]
if (not poss):
    poss |= possible(coords[0], coords[1], coords + [start])[0]
        
if poss:
    print('Yes')
else:
    print('No')


n = int(input())
arr = list(map(int,input().split()))
marr= [(arr[2]-arr[0])/2,arr[2]-arr[1],arr[1]-arr[0]]
for m in marr:
	arr1=[]
	for x,y in enumerate(arr):
		arr1.append(y-m*(x+1))
	if len(set(arr1))==2:
		print("Yes")
		return
print("No")

def coef(a, b):
    ax, ay = a
    bx, by = b
    return (by-ay)/(bx-ax)

def coefl(line):
    return coef(line[0], line[1])

def fitline(c, line):
    if len(line) <= 1:
        return True
    return coef(line[0], line[1]) == coef(line[0], c)

def same(linea, lineb):
    linec = list(lineb)
    for p in linea:
        if not fitline(p, linec):
            return False
        linec.append(p)
    return True

def allpointsfit(linea, lineb, pointset):
    for p in pointset:
        if fitline(p, linea):
            linea.append(p)
        elif fitline(p, lineb):
            lineb.append(p)
        else:
            return False
    if len(linea) == 0 or len(lineb) == 0:
        return False
    if same(linea, lineb):
        return False
    fit = len(linea) == 1 or len(lineb) == 1 or (coefl(linea) == coefl(lineb))
    return fit

n = int(input())
a = [int(x) for x in input().split()]
ans = (len(set(a)) == 2)
points = [(idx+1, val) for idx, val in enumerate(a)]
ans = ans or allpointsfit([points[0], points[1]], [points[2]], points[3:])
ans = ans or allpointsfit([points[1], points[2]], [points[0]], points[3:])
ans = ans or allpointsfit([points[0], points[2]], [points[1]], points[3:])
ans = ans or allpointsfit([], [], points)
print('Yes' if ans else 'No')

n=int(input())
y=list(map(int,input().split()))
def check(d):
    return len(set(2*yi-d*i for i,yi in enumerate(y)))==2

print('Yes' if any(check(d) for d in [2*(y[1]-y[0]),2*(y[2]-y[1]),y[2]-y[0]]) else 'No')

n=int(input())
y=list(map(int,input().split()))
def check(d):
    return len(set(2*yi-d*i for i,yi in enumerate(y)))==2

print('Yes' if any(check(d) for d in [2*(y[1]-y[0]),2*(y[2]-y[1]),y[2]-y[0]]) else 'No')