Register_count and bit reading help

I’m trying to use this code copied from others to read the registers below. Each Fault has a register, the first Fault1 is 0x0405 and the last Fault18 is 0x0416. Each register has two bytes and each byte has two bits.
If I use register_count how should I continue the code?

 - platform: modbus_controller               ## Inverter Fault Message ##
   modbus_controller_id: zcs                 ## Fault 1 ##
   name: Errore Inverter
   id: inverter_fault_message
   register_type: holding
   address: 0x0405
   skip_updates: 20
   register_count: 18
   response_size: 2
   lambda: |-
     std::string z = "";
     int idx = item->offset;
     //byte[0]
     if ((data[idx] & 0x1) != 0) z += "ID001 GridOVP,";
     if ((data[idx] & 0x2) != 0) z += "ID002 GridUVP,";
     if ((data[idx] & 0x4) != 0) z += "ID003 GridOFP,";
     if ((data[idx] & 0x8) != 0) z += "ID004 GridUFP,";
     if ((data[idx] & 0x128) != 0) z += "ID008 IslandFault,";
## what should be written here?
     if(z.length() > 0){
        z.pop_back();
      }
      return {z};



Can anyone help?