Find distinct groups with no common parents
arr[] can be considered a partial order, and the groups you're looking for are then called antichains. So, you're looking for a decomposition into a minimum number of antichains of the partial order represented by arr[]. According to Mirsky's theorem, the smallest achievable number of antichains is equal to the length of the longest chain -- that is, the longest path of descendants in the forest (set of trees) represented by arr[]. (It's impossible to do better than this, since every element in this longest chain needs to be assigned to a distinct antichain.)
That Wikipedia page also describes a neat way to actually construct an optimal set of antichains, based on the idea that if two elements have the same number of ancestors, neither of them can be an ancestor of the other. In short: Perform BFS on the forest defined by arr[], starting from all root elements (you can do this by initially inserting all such elements into the queue); every layer (set of nodes at the same depth) constitutes one antichain.