<s>[INST] This problem was asked in a programming contest. I was unable to solve it. I am sharing it with you guys so that we can work together to find a solution. 

In a company, there are n groups of employees. Each group can have a different number of employees, and each group is led by a manager. The leader of each group is also an employee of that group. If we denote the groups by the integers 1, 2, . . . , n, and we denote the manager of group i by a[i], then for each group i, we have 1 ≤ a[i] ≤ n. In other words, a[i] is the manager of group i, a[j] is the manager of group j, and so on.

Now, each employee has a specific, unique skill. Suppose we have the skill levels of all the employees in the array skill, where skill[i] is the skill level of employee i. If a group i is led by its employee j, then the skill level of this group is the skill level of employee j. 

In this company, an "upgrade operation" is an operation that promotes one employee to become the manager of their group, and this can be done only if the skill level of this employee is strictly greater than the skill level of the current manager of their group. 

The goal of this company is to make the skill level of all groups as high as possible by performing the upgrade operations. What is the maximum number of upgrade operations that can be performed in this company?[/INST]