Task: Program Execution
Input (English): N, i, 6975, 1799, 9709, K, S
Output (English): 3