Code Golf array-manipulation counting
Given a list of positive integers, output how many items are strictly less than the previous item. The first item will never be counted.
### Test cases
|`[1 2 5 8 12 21 51]`|`0`|
|`[4 2 5 2 1 5 2]`|`4`|
|`[4 5 3 6 2 7 1 8]`|`3`|
|`[3 3 3 1 1 1]`|`1`|
Top Answer
# [APL (Dyalog Unicode)], 6 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") [^SBCS^](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")

Anonymous tacit prefix function. The rare case of ASCII-only APL!

[Try it online!][TIO-k84oab5w]

|`+`|the numbers
|`2>/`|pairwise greater-than

[APL (Dyalog Unicode)]: https://www.dyalog.com/
[TIO-k84oab5w]: https://tio.run/##SyzI0U2pTMzJT///X1vfyE5f@3/ao7YJj3r7HnU1P@pd86h3y6H1xo/aJj7qmxoc5AwkQzw8g/@nKRgqGCmYKlgoGBopGBkqmBpypSmYgIWMgFJAEsw3VTBWMAOKmAPFLIAixmBoCIIA "APL (Dyalog Unicode) – Try It Online"
Count inverted items
Adám replying to Jack Douglas
Of course. My bad.
Jack Douglas replying to Adám
'less than' looks right to me — 2 is the second item and 1 is the first, isn't it?
@A-ee Ah, you mean *strictly **greater** than*, no?
@A-ee Wait, can you explain how this works? E.g. for the first test case, 1 is strictly less than 2, no? so how can the result be 0?
Jack Douglas replying to A-ee
I've changed it to regular 'Code Golf'
Adám replying to A-ee
I can't, but current procedure is to flag and comment.
A-ee replying to Adám
The speed aspect was a misclick... can you change it to Code Golf?
Adám replying to A-ee
Any particular reason? I like it. It just needs a spec for the speed aspect.
A-ee replying to Adám
@Adám Because I want to delete it.
@A-ee Why the flag?
A-ee replying to Adám
@Adám I don't know - how can I delete it?
@A-ee How is this timed?
I just noticed this is speed challenge. Do you intend that rather the code golf? I don't understand how it would work. And it seems pretty trivial in terms of run-time to do this quickly by iterating once through the list.
I made some edits, let me know if they look OK
I think some test cases where adjacent elements are equal would be good
A-ee replying to Adám
I'd explicitly specify that in the body.
@liek So the first element will never be counted?