n, m = int(input()) point = [] for i in range(n): if i == 0: point.append(2) else: point.append(0) for i in range(n): if i == 0: if point[n-1] or point[1] == 2: point[0] = 1 elif point[0] == 2: point[0] = 0 else: point[0] = 1 elif i == n-1: if point[0] or point[n-2] == 2: point[0] = 1 elif point[i] == 2: point[i] == 0 else: point[i] = 1 else: if point[i-1] or point[i+1] == 2: point[i] = 1 elif point[i] == 2: point[i] == 0 else: point[i] = 1 num = point.count(2) print(num)