# JavaScript ES6, <s>87</s> <s>82</s> <s>79</s> <s>74</s> 70 bytes


Don't like using an object but it seems to be the shortest way to keep track of dupes

## Explanation

    (a,b={})=>          `a` is input
                        `b` stores the occurrences of each number
      a.map(l =>        Loop over the array, `l` is item
      [...a]            Copy `a`
        .sort(...)       Sort in ascending numerical order
        .indexOf(l)      Index of input in that array
      +                 Add the following to account for dupes
       (b[l]=            set and return the item `l` in hashmap `b` to...
         b[l]+1           Increase the counter by one if it exists yet
         |0               default is zero