the counting and values provided by $hfl and $hflc are wrong and incomplete from my understanding. looking at the source code these pseudo vars count the body values of Via, Record-Route and Route headers.
in kamalio 5.6.1
with Record-Route: sip:1.1.1.1;lr=on;nat=yes Record-Route: sip:2.2.2.2:5060;lr;transport=udp,sip:3.3.3.3:22506;lr;transport=udp
i get $hflc(Record-Route) == 2 instead of 3
and $(hfl(Record-Route)[0]) == 1.1.1.1 $(hfl(Record-Route)[1]) == 2.2.2.2
$(hfl(Record-Route)[3]) does not exists.