// Problem : 
// 			B - Making Triangle
// 			
// 		
// Contest : AtCoder - AtCoder Beginner Contest 175
// URL : https://atcoder.jp/contests/abc175/tasks/abc175_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*when the going gets tough the tough gets going  */
/*we are what we repeatedly do , Excellence then is not an act but a habit  - aristotle */
/*The best way to predict the future is to create it - abraham lincoln*/
/*First think , second believe , third dream and finally dare - walt disney*/
/*It is during our darkest moments that we must focus to see the light */
/*Nothing is impossible the word itself says "i'm fucking possible man just try me again and again till i seem impossible "*/
/*Dont judge each day by the harvest you reap but by the seeds you plant */
/*Do not dwell in the past, do not dream of the future, concentrate the mind on the present moment*/
/*Success is not final failure is not fatal : it is the courage to continue that counts */ 
/*the future belongs to those who believe in the beauty of their dreams */
/*The pessimist complains about the wind , the optimist waits for it to change; the realist adjusts the sails  */
/*Believe you can and you are half way there */
/*Everything has beauty but not everyone sees it */
/*Life is not about finding yourself , life is about creating yourself*/
/*You are the average of the 5 people you spend the most time with .........*/
/*Everything is hard before it is easy see for example now the list of examples is very long hahahahahaha...... ......*/
/*I believe in miracles .......*/
#include<bits/stdc++.h>
#define LL long long 
#define LD long double
#define pb push_back

#define P(n,m) pair<n,m> 

#define V(n) vector<n>
#define IN insert
#define wht while (t--)
#define FU( i , a  , n ) for ( int i = (int)a ; i <=(int)n ; i++  )
#define FD( i , n , a ) for (int i = (int)n ; i >=(int)a ;i--)
#define REP(i,n) for ( int i = 0 ; i < (int)n;  i++)
#define FST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define SZ(a) int((a).size())
#define pi(n) printf("%d" , n ) 
#define pl(n) printf("%lld" , n )
#define ff first
#define ss second
#define ii(n) scanf("%d" , &n)
#define il(n) scanf("%lld" , &n )
#define LB lower_bound
#define UB upper_bound
#define BS binary_search
#define ALL(V) V.begin(), V.end()
#define ic(n) cin>>n
#define pr printf
#define INF 99999999
#define en endl
using namespace std ;
struct HASH {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    static uint64_t splitmix64(const pair<LL,LL>& p) {
        // http://xorshift.di.unimi.it/splitmix64.c
         static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        LL x = p.first + FIXED_RANDOM, y = p.second+ FIXED_RANDOM;
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
          y += 0x9e3779b97f4a7c15;
        y = (y ^ (y >> 30)) * 0xbf58476d1ce4e5b9;
        y = (y ^ (y >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31) ^  y ^ (y >> 31);
    }

    size_t operator()(const pair<LL,LL>& p) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(p);
    }
};
const int dx4[4]={-1, 0, 1, 0}, dy4[4]={0, 1, 0, -1};
const int dx8[8]={-1, -1, 0, 1, 1, 1, 0, -1}, dy8[8]={0, 1, 1, 1, 0, -1, -1, -1};

int n;
string str ;

void solve()
{
	int   m ,a , b ,c ;
	cin>> n ;
	int arr[n];
	REP(i , n ) cin >> arr[i] ;
	sort(arr, arr + n ) ;
	// map< tuple<int,int,int> , bool > mp ; 
	int cnt = 0 ;
	REP(i, n ) 
	{
		for (int j = i + 1 ; j < n ; j++ )
		{
			for (int k = j + 1 ; k < n ; k++ ) 
			{
				if (arr[i] == arr[j] || arr[j] == arr[k] ) 
				{
					continue;
				}
				if (arr[i] + arr[j] > arr[k] ) 
				{
					// cout << arr[i] << " " << arr[j] << " " << arr[k] << en;
				     cnt++;
				}
			}
		}
	}
	cout << cnt ;
}
int main()
{
	FST;
	int tc = 1 ;
    // cin>> tc;
    while(tc--)
    {
    	solve();
    }	
   
   
	return 0 ;
	
 
} 

Measured memory_bytes: 3676