Ticket is related to this solution
// this can be also solved with
// return count(array_unique($A));
This is result with array_unique()
https://codility.com/demo/results/demoATDHG8-X7Z/
Only 66% for Performance
But according to this article this task can be solved with native php functions keeping good Performance score
return count(array_flip(array_flip(array_reverse($A,true))));
;)