Orig Description
Circular Sugoroku
Yuki made a sugoroku (Japanese board game similar to Snakes and Ladders) for the children's event so that everyone can play together. In this sugoroku, the squares are arranged in a circle, and each square has an integer greater than or equal to 1 written on it.
The player chooses a square as the starting point and places their piece there. Then, they move their piece clockwise according to the number written on the square. They repeat this process, moving clockwise according to the number written on the square they land on, until they reach the starting point again, at which point they win.
In reality, there may be cases where it is impossible to win, depending on which square the player chooses as their starting point. Yuki wants to count the number of squares from which it is possible to win.
Write a program that takes the information of a sugoroku as input and reports the number of squares from which it is possible to win.
Input
The input is given in the following format.
N
a1 a2 ... aN
The first line contains the number of squares N (1 ≤ N ≤ 100000) in the sugoroku. The second line gives the clockwise order of integers written on each square ai (1 ≤ ai ≤ 109).
Output
Print the number of squares from which it is possible to win.
Sample Input 1
3
1 1 1
Sample Output 1
3
Sample Input 2
3
1 1 2
Sample Output 2
2
Sample Input 3
8
2 3 7 3 3 3 4 4
Sample Output 3
6
Extracted Specification
An integer N (1 ≤ N ≤ 100000), representing some quantity or size.
A list of integers a of size N, where each integer is between 1 and 10^9.
### Example Input:
```
3
1 1 2
```
### Function Signature:
Write a function f(N, a) that takes in the input.
```python
def f(N: int, a: List[int]):
'''
N: an integer
a: a list of integers
'''
```
Test Case Generator
Certainly! Here's a test case generator for the "Circular Sugoroku" problem:
```python
import random
def tcgen():
N = random.randint(1, 100000) # Number of squares (1 ≤ N ≤ 100000)
# List of integers written on each square, each integer ai (1 ≤ ai ≤ 10^9)
a = [random.randint(1, 10**9) for _ in range(N)]
return N, a
# Example usage:
N, a = tcgen()
print(N)
print(" ".join(map(str, a)))
```
This test case generator will produce random inputs for the "Circular Sugoroku" problem with the constraints provided. The generated test cases will help you test the robustness and performance of your solution. Here are the elements of the generator:
1. **N:** Randomly generated number of squares, ensuring it falls within the range \[1, 100000\].
2. **a:** List of integers representing the number of steps to move in the sugoroku game, each falling within the range \[1, \(10^9\)\].
You can run this generator multiple times to create different test cases for your problem.
Let's run an example to see the generated output:
```python
N, a = tcgen()
print(N) # Prints the number of squares
print(" ".join(map(str, a))) # Prints the list of integers in the sugoroku
```
This will produce an output similar to:
```
100
123456789 987654321 456789123 ... # and so on, with 100 numbers in the range [1, 10^9]
```
Each execution of `tcgen()` will provide a new, random test case for the "Circular Sugoroku" problem.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
A = list(map(int, fh.readline().strip().split()))
return N, A