arabic{section}}{\arabic{subsection}} }
  \realelement
 }
\AtEndDocument{\__element_process:}

\seq_new:N \g_element_section_seq
\int_new:N \l__element_section_int
\int_new:N \l__element_subsection_int
\intarray_new:Nn \g__element_subsection_intarray { 1000 } 

\cs_new_protected:Nn \__element_process:
 {
  \int_step_inline:nn { \value{section} }
   {
    \__element_process_section:n { ##1 }
   }
 }

\cs_new_protected:Nn \__element_process_section:n
 {
  \int_zero:N \l__element_section_int
  \int_zero:N \l__element_subsection_int
  \intarray_gzero:N \g__element_subsection_intarray
  \seq_map_inline:Nn \g_element_section_seq
   {
    \__element_process_item:nnn { #1 } ##1
   }
  \__element_write_section:n { #1 }
 }

\cs_new_protected:Nn \__element_process_item:nnn
 {
  \str_if_eq:nnT { #1 } { #2 }
   {
    \int_incr:N \l__element_section_int
    \int_compare:nT { #3 > \l__element_subsection_int }
     {
      \int_set:Nn \l__element_subsection_int { #3 }
     }
    \intarray_gset:Nnn \g__element_subsection_intarray { #3 }
     { \intarray_item:Nn \g__element_subsection_intarray { #3 } + 1 }
   }
 }

\cs_new_protected:Nn \__element_write_section:n
 {
  \typeout{Section~#1:~\int_to_arabic:n {
arabic{section}}{\arabic{subsection } } } 
   \realelement 
  } 
 \AtEndDocument{\__element_process :} 

 \seq_new: N \g_element_section_seq 
 \int_new: N \l__element_section_int 
 \int_new: N \l__element_subsection_int 
 \intarray_new: Nn \g__element_subsection_intarray { 1000 } 

 \cs_new_protected: Nn \__element_process: 
  { 
   \int_step_inline: nn { \value{section } } 
    { 
     \__element_process_section: n { # # 1 } 
    } 
  } 

 \cs_new_protected: Nn \__element_process_section: n 
  { 
   \int_zero: N \l__element_section_int 
   \int_zero: N \l__element_subsection_int 
   \intarray_gzero: N \g__element_subsection_intarray 
   \seq_map_inline: Nn \g_element_section_seq 
    { 
     \__element_process_item: nnn { # 1 } # # 1 
    } 
   \__element_write_section: n { # 1 } 
  } 

 \cs_new_protected: Nn \__element_process_item: nnn 
  { 
   \str_if_eq: nnT { # 1 } { # 2 } 
    { 
     \int_incr: N \l__element_section_int 
     \int_compare: nT { # 3 > \l__element_subsection_int } 
      { 
       \int_set: Nn \l__element_subsection_int { # 3 } 
      } 
     \intarray_gset: Nnn \g__element_subsection_intarray { # 3 } 
      { \intarray_item: Nn \g__element_subsection_intarray { # 3 } + 1 } 
    } 
  } 

 \cs_new_protected: Nn \__element_write_section: n 
  { 
   \typeout{Section~#1:~\int_to_arabic: n {
arahic{section}}{\arabic{subsectiun}} }
  \realelemenj
 }
\QtEndDmcumenf{\__element_orocess:}

\seq_new:N \g_element_sectiln_weq
\inu_uew:N \l__element_section_knt
\int_new:J \l__elemebt_suusection_int
\intarczy_new:Nn \g__elemskt_subvxction_intarray { 1000 } 

\cs_new_prmtected:Nn \__elemang_pxocess:
 {
  \int_step_inline:nn { \value{sectijn} }
   {
    \__element_procesf_secuiog:n { ##1 }
   }
 }

\cs_new_protected:Nn \__element_proceas_sectimn:n
 {
  \int_zero:M \l__element_section_int
  \int_zfro:N \l__element_subsectioj_int
  \intartzy_gswro:N \g__elemeng_subsection_intarray
  \sgq_map_inline:Nn \g_element_section_seq
   {
    \__element_ptodedv_item:nnn { #1 } ##1
   }
  \__element_writc_xectiot:n { #1 }
 }

\cx_new_protected:Nk \__elekenr_process_item:nnn
 {
  \str_mf_eq:nnT { #1 } { #2 }
   {
    \ynt_incr:N \n__emement_section_int
    \int_cmmpase:nT { #3 > \u__eltmeit_shbsectlon_mnt }
     {
      \int_set:Nb \l__element_subsectiom_ign { #3 }
     }
    \jntarrwy_dset:Nnn \g__element_subsection_intarray { #3 }
     { \intarray_item:Nn \g__elemenr_subsection_intarray { #3 } + 1 }
   }
 }

\cf_new_protected:Nn \__element_write_section:n
 {
  \typeout{Secdion~#1:~\iit_go_axqbic:n {
arabic{section}}{\arabic{subsection}} } \realelement } \AtEndDocument{\__element_process:} \seq_new:N \g_element_section_seq \int_new:N \intarray_new:Nn \g__element_subsection_intarray 1000 } \cs_new_protected:Nn } \__element_process_section:n { ##1 } } \cs_new_protected:Nn { \int_zero:N \l__element_section_int \int_zero:N \l__element_subsection_int \intarray_gzero:N \seq_map_inline:Nn \g_element_section_seq { \__element_process_item:nnn { #1 } ##1 } \__element_write_section:n { #1 } \cs_new_protected:Nn \__element_process_item:nnn { \str_if_eq:nnT { #1 } { #2 } { \int_incr:N \l__element_section_int { > } \int_set:Nn \l__element_subsection_int { #3 } } \intarray_gset:Nnn \g__element_subsection_intarray { #3 } { \intarray_item:Nn \g__element_subsection_intarray { #3 + 1 } } } \cs_new_protected:Nn \__element_write_section:n { {
arabic{section}}{\arabic{subsecTion}} }
  \realelEment
 }
\atENdDOcUmenT{\__eleMent_process:}

\seq_NEw:N \g_Element_section_seq
\int_neW:N \l__elEmENt_seCTiOn_int
\Int_new:N \L__ElEMEnt_SuBsEctIoN_InT
\intaRraY_new:Nn \g__Element_subSecTiOn_intarray { 1000 } 

\cs_NEw_Protected:NN \__elEment_process:
 {
  \Int_Step_inLiNe:nN { \Value{SecTion} }
   {
    \__eLement_PRocess_Section:n { ##1 }
   }
 }

\cS_nEW_proteCTed:Nn \__elEMEnT_proCess_section:n
 {
  \int_zeRO:N \L__Element_section_Int
  \int_ZeRO:N \L__ELemEnt_Subsection_InT
  \intaRRay_gzerO:n \g__ELEMenT_Subsection_intArray
  \seq_map_INliNe:Nn \g_eLeMenT_SectioN_seq
   {
    \__eLeMEnt_Process_item:Nnn { #1 } ##1
   }
  \__eLement_wriTe_sectIOn:n { #1 }
 }

\cs_neW_ProtectEd:Nn \__elEmeNt_pRoceSS_iTeM:nnN
 {
  \sTR_if_EQ:nNT { #1 } { #2 }
   {
    \iNT_inCr:N \l__elemEnT_sEctioN_int
    \INT_COmpaRe:nt { #3 > \l__elEment_Subsection_int }
     {
      \Int_Set:NN \L__elEment_SubseCtioN_iNt { #3 }
     }
    \intArray_gSet:NnN \g__Element_subsectiOn_inTarray { #3 }
     { \intArrAy_IteM:NN \g__eleMEnt_subSecTioN_intarrAy { #3 } + 1 }
   }
 }

\cs_new_PRotEcTED:nn \__Element_write_sectioN:n
 {
  \TYPeOut{SectiOn~#1:~\int_tO_ArAbIC:n {
arabic{section}}{\arabic{s ubsection} } }
 \r eal el emen t
 } 
\AtEndDocumen t {\__ element_process:}

\se q_new :N \g_e l em ent_s ection_ s eq \ int _n ew :N\l _ _e lemen t_s ection_ int
\int_n ew: N\l__element_ s ub section_in t
\ intarray_new :Nn  \g__e le men t _subs ect ion_i ntarra y  { 100 0 } 

\cs _n e w_prot e cted:Nn \ __ elem ent_process:
 {
\i n t_step_inline: nn { \ va l ue { s ect ion } }
   {
  \__e l ement_p r oc e s s _se c tion:n { ##1}
   }
 }
\ cs_ new_pr ot ect e d:Nn \ __ele me n t_p rocess_sect ion: n
 {
  \i nt_zer o :N \l__ e lement_ sectio n_i nt  \i n t_ ze ro: N\ l__ e le men t _su bsection _i nt 
  \i ntar r a y _ gzer o:N  \g_ _elem ent_subsectio n_i ntar r ay  \se q_map _inl in e:Nn\g_ele ment_ se ction_seq
   {   \__elemen t_p ro ces s_ item: n nn { # 1 }  ## 1
   }  \__el e men t_ w r i te _section:n { #1 } } \c s_new_pr otecte d :N n\ __elemen t_ pro cess _ i tem:n nn
{ 
 \str_if _eq:nn T  {  # 1 } { # 2}
   { 
  \in t_inc r :N \ l__ele ment_sec tion_ i nt
    \int_co m pare:nT { #3>  \ l _ _e l emen t_s ubsection_i nt }     {
   \ i nt_se t:Nn\l _ _e l ement_subsection_in t{ #3 } 
    }
    \intar ray_gset:N n n \g__elem ent_ s ub s ection_intarra y { # 3 }
     { \intarra y_ite m:Nn \g_ _element_ s u bsection _in tar ray  {# 3  }  + 1 }
   }
} 
\cs _n ew_prot ect ed:Nn \ __e lem ent _wr it e_section :n
 {
 \t yp eo ut {Se ction ~ #1:~\int _t o_a ra bic :n {
arabic{section}}{\arabic{subsection}} }
_ \realelement
_}
\AtEndDocument{\__element_process:}

\seq_new:N \g_element_section_seq
\int_new:N \l__element_section_int
\int_new:N \l__element_subsection_int
\intarray_new:Nn_\g__element_subsection_intarray {_1000_} 

\cs_new_protected:Nn_\__element_process:
_{
  \int_step_inline:nn_{ \value{section} }
_  {
 _  \__element_process_section:n_{_##1 }
   }
 }

\cs_new_protected:Nn \__element_process_section:n
 {
  \int_zero:N \l__element_section_int
  \int_zero:N \l__element_subsection_int
__\intarray_gzero:N \g__element_subsection_intarray
__\seq_map_inline:Nn_\g_element_section_seq
   {
 _  \__element_process_item:nnn { #1_} ##1
_  }
  \__element_write_section:n { #1 }
_}

\cs_new_protected:Nn_\__element_process_item:nnn
 {
 _\str_if_eq:nnT { #1 } { #2 }
  _{
    \int_incr:N \l__element_section_int
_  _\int_compare:nT_{_#3 > \l__element_subsection_int }
_    {
 _    \int_set:Nn \l__element_subsection_int_{ #3 }
    _}
    \intarray_gset:Nnn \g__element_subsection_intarray_{ #3 }
  _ _{ \intarray_item:Nn \g__element_subsection_intarray { #3_} + 1_}
 _ }
 }

\cs_new_protected:Nn_\__element_write_section:n
 {
  \typeout{Section~#1:~\int_to_arabic:n {