#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end();
#define sz(x) (int)(x).size()
#define FOR_(i, a, b, s) \
  for (int i = (a); (s) > 0 ? i < (b) : i > (b); i += (s))
#define FOR1(n) FOR_(i, 0, n, 1)
#define FOR2(i, n) FOR_(i, 0, n, 1)
#define FOR3(i, a, b) FOR_(i, a, b, 1)
#define GET5(_1, _2, _3, _4, _5, ...) _5
#define FOR(...) GET5(__VA_ARGS__, FOR_, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define each(x, a) for (auto&& x : a)

using namespace std;

using ll = long long;
using ld = long double;
template <typename A>
using vt = vector<A>;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) { return '"' + s + '"'; }

string to_string(const char* s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) void()
#endif

constexpr int MX = 200005;
constexpr int INF = 1000000202;
constexpr ll LINF = 1000000000000000202LL;
constexpr ll MOD = 1000000007;  // 998244353;
constexpr ld PI = 3.1415926535897932384626433832795029L;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vt<int> l(n);
  FOR(n) cin >> l[i];
  int cnt = 0;
  FOR(i, n) {
    FOR(j, i + 1, n) {
      FOR(k, j + 1, n) {
        if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i]) continue;
        if (l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 3660