n = int(input()) r = -1 for x in map(int, input().split()): if r == -1: r = x % n elif x % n != r: print('No') break else: print('Yes')