N = input() Line = map(int, input().split(' ')) Line2 = [x - i for (x,i) in enumerate(Line)] print(max(Line2))