Longest Arithmetic Progression in an array

How to we find out the length of the longest arithmetic progression in an array, which is not sorted and also has duplicates in it?