n = int(input()) a = list(map(int,input().split())) cum = a[0]+a[n-1] for i in range(n): if a[i] +a[n-i-1] != cum: print("No") exit() print("Yes")