#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

ll isGood(int i,int j,int k,vll& vec){
    // Verified
    bool cond1 = vec[i] + vec[j] > vec[k];
    bool cond2 = vec[j] + vec[k] > vec[i];
    bool cond3 = vec[k] + vec[i] > vec[j];
    bool cond4 = vec[i] != vec[j];
    bool cond5 = vec[j] != vec[k];
    bool cond6 = vec[k] != vec[i];

    if(cond1 && cond2 && cond3 && cond4 && cond5 && cond6){
        return 1;
    }else{
        return 0;
    }
}
void B(){
    int N; cin >> N;
    vll vec(N);
    rep(i,N) cin >> vec[i];
    ll cnt = 0;
    for(int i = 0; i < N-2; i++){
        for(int j = i+1; j < N-1; j++){
            for(int k = j +1; k < N; k++){
                cnt += isGood(i,j,k,vec);
            }
        }
    }
    cout << cnt << endl;
}

void C(){
    //Verified
    ll X,K,D; cin >> X >> K >> D;

    ll PlusMax = X + K*D;
    ll MinusMax = X - K*D;

    if(X < 0){
        if(PlusMax <= 0){
            cout << PlusMax << endl;
            return;
        }
    }else if(X > 0){
        if(MinusMax >= 0){
            cout << MinusMax << endl;
            return;
        }
    }else{
        if(K%2 == 0){
            cout << 0 << endl;
            return;
        }else{
            cout << D << endl;
            return;
        }
    }

    if(X < 0){
        ll Hopcount = 0; // zero is yet to move at all
        Hopcount = abs(X)/D;
        ll remain = K - Hopcount;

        if(remain%2 == 0){
            cout << abs(X + D * Hopcount) << endl;
            return;
        }else{
            cout << X + D * (Hopcount+1) << endl;
            return;
        }
    }else{
        ll Hopcount = 0;
        Hopcount = abs(X) / D;
        ll remain = K - Hopcount;

        if(remain%2 == 0){
            cout << X - D * Hopcount << endl;
            return;
        }else{
            cout << abs(X - D * (Hopcount+1)) << endl;
            return;
        }
    }
}

int main(){
    B();
    sysp;
}

Measured memory_bytes: 3608