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