A secure aggregate maximum system comprising a plurality of secure computation apparatuses (1 1,..., 1 N), F being an arbitrary ring, m being an integer equal to or greater than 2, [v]: = [v 0],..., [v m-1] being a share obtained by secret sharing a desired value attribute v: = v 0,..., v m-1 ∈ F, when a table including a key attribute and a value attribute is stably sorted in ascending order of a value of the value attribute and a value of the key attribute, [e]: = [e 0],..., [e m-1] being a share obtained by secret sharing a flag e: = e 0,..., e m-1 wherein for each integer i equal to or greater than 0 and equal to or less than m-1, each e i is indicating true if the corresponding value v i is a last element a group and indicating false otherwise when the table is grouped based on the value of the key attribute, {{σ}} being a share obtained by secret sharing a permutation σ which moves elements so that the last elements of each group are sequentially arranged from beginning and other elements are sequentially arranged when the table is grouped based on the value of the key attribute, and g being a maximum number of the groups, characterized in that each of the secure computation apparatuses comprises: a flag applying part configured to generate a share [f] which becomes a vector f: = fo,..., f m-1 ∈ F when reconstructed, by setting [v i] at [f i] if [e i] is true, and setting a predetermined fixed value which the value attribute v never takes at [f i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v] and the share [e], a sorting part configured to generate a share [σ(f)] which becomes a sorted vector σ(f) obtained by sorting the vector f with the permutation σ, when reconstructed, using the share [f] and the share {{σ}}, and an output part configured to generate a share [x] which becomes a vector x: = σ(f) 0,..., σ(f) min(g,m)-1 ∈ F representing a maximum of each group, when reconstructed, using the share [σ(f)]. F being an arbitrary ring, m being an integer equal to or greater than 2, [v]: = [v 0],..., [v m-1] being a share obtained by secret sharing a desired value attribute v: = v 0,..., v m-1 ∈ F, when a table including a key attribute and a value attribute is stably sorted in ascending order of a value of the value attribute and a value of the key attribute, [e]: = [e 0],..., [e m-1] being a share obtained by secret sharing a flag e: = e 0,..., e m-1 wherein for each integer i equal to or greater than 0 and equal to or less than m-1, each e i is indicating true if the corresponding value v i is a last element a group and indicating false otherwise when the table is grouped based on the value of the key attribute, {{σ}} being a share obtained by secret sharing a permutation σ which moves elements so that the last elements of each group are sequentially arranged from beginning and other elements are sequentially arranged when the table is grouped based on the value of the key attribute, and g being a maximum number of the groups, characterized in that each of the secure computation apparatuses comprises: a flag applying part configured to generate a share [f] which becomes a vector f: = fo,..., f m-1 ∈ F when reconstructed, by setting [v i] at [f i] if [e i] is true, and setting a predetermined fixed value which the value attribute v never takes at [f i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v] and the share [e], a sorting part configured to generate a share [σ(f)] which becomes a sorted vector σ(f) obtained by sorting the vector f with the permutation σ, when reconstructed, using the share [f] and the share {{σ}}, and an output part configured to generate a share [x] which becomes a vector x: = σ(f) 0,..., σ(f) min(g,m)-1 ∈ F representing a maximum of each group, when reconstructed, using the share [σ(f)]. a flag applying part configured to generate a share [f] which becomes a vector f: = fo,..., f m-1 ∈ F when reconstructed, by setting [v i] at [f i] if [e i] is true, and setting a predetermined fixed value which the value attribute v never takes at [f i] if [e i] is false for each integer i equal to or greater than 0 and equal to or less than m-1 using the share [v] and the share [e], a sorting part configured to generate a share [σ(f)] which becomes a sorted vector σ(f) obtained by sorting the vector f with the permutation σ, when reconstructed, using the share [f] and the share {{σ}}, and an output part configured to generate a share [x] which becomes a vector x: = σ(f) 0,..., σ(f) min(g,m)-1 ∈ F representing a maximum of each group, when reconstructed, using the share [σ(f)].