with open('input', 'r') as f: adapters = list(map(int, f.readlines())) adapters.sort() print(adapters) num1 = 0 num3 = 1 prev = 0 for adapter in adapters: if adapter - prev == 1: num1 += 1 if adapter - prev == 3: num3 += 1 prev = adapter print(f'Number of adapters: {len(adapters)}') print(f'1-jolt: {num1}, 3-jolt: {num3}') print('Solution:') print(num1 * num3)