from decimal import * import math n = int(input()) A = [] count = 1 for i in range(n): A.append(int(input())) for i in range(n): for j in range(i+1,n): if abs(A[i] - A[j]) < 2: count += 1 print(count)