It was trickier than I first thought.
So it looks like deleting the index as you go doesn't work, because the loop index/current x doesn't match up anymore after you delete one.
So I used a second array to "store" all the singles i found in the first index, then went back and deleted them after.
Unfortunately it doesn't work with 0 at either end of the array, because values that are outside of the array range are returned as 0s, so it thinks it is next to another 0.
Edit: actually now that I think of it some more I feel like I've done this before another way. If IndexOf and LastIndexOf match, then there is only one of that value. I'll experiment a bit more...