QUESTION
A University has invited N alumni to a dinner. The dinner table is circular in shape. The university has assigned each alumnus an invitation ID from 1 to N. Each alumnus likes exactly one fellow alumnus and will attend the dinner only if he/she can be seated next to that person.
You are asked to plan the seating arrangement. Write an algorithm to find the maximum number of alumns who will attend the dinner.
Input:
The first line of the input consists of an integer person ld size, representing the number of alumni (N). The second line consists of N space-separated integers representing the ID of the person whom the alumnus likes.
Output:
Print an integer representing the maximum number of alumni who can attend the dinner.
Note : One alumnus can be liked by more than one alumni.
N <= 1e5