#include using namespace std; typedef long long ll; using VI = vector; using VL = vector; using VVI = vector; using VVL = vector; using VS = vector; using VC = vector; using Q = queue; using P = pair; using llP = pair; #define sz(x) ((int)(x).size()) #define in(x) int x;cin>>x #define inn(x, y) int x,y;cin>>x>>y #define innn(x, y, z) int x,y,z;cin>>x>>y>>z #define bit(n) (1<<(n)) void _print(ostream&){} template void _print(ostream&s,const T&t,const U&...u){s< void out(const T&...t){_print(cout,t...);} template void err(const T&...t){_print(cerr,t...);} #define strictout(x, precision) cout<bool chmax(T&a,const U&b){bool x=abool chmin(T&a,const U&b){bool x=a>b;x?a=b:b;return x;} templateauto max(const T&a,const U&b){return aauto min(const T&a,const U&b){return a> a[i]; ll ans = 0; rep(i, n-1){ repa(j, i+1, n) { ans += mex(a[i], a[j]); } } out(ans); return 0; }