n = int(input()) a = list(map(int, input().split())) s = a[0] + a[n-1] ans = all(x + y == s for x, y in zip(a, reversed(a))) print('Yes' if ans else 'No')