there n soldier stand line each soldier assign unique rating valueyou form team 3 soldier follow rulesChoose 3 soldier index j k rating ratingi ratingj ratingkA team valid ratingi ratingj ratingk ratingi ratingj ratingk 0 j k nReturn number team form give condition soldier multiple team example 1input rating 25341output 3explanation we form team give condition 234 541 531 Example 2input rating 213output 0explanation we can not form team give conditionsexample 3input rating 1234output 4 Constraintsn ratinglength3 n 10001 ratingi 105All integer rating unique