#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;
#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) <<  
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back
int main()
{
	ll n,j;
	ll c=1;
	cin >> n;
	vec a(n);
	REP(i,0,n){
		cin >> a[i]; 
	}
	// std::unique(a.begin(), a.end());
	std::sort(a.begin(), a.end());
	// a.erase(std::unique(a.begin(), a.end()), a.end());
	j = n * (n-1) /2;
	REP(i,0,n-1){
		// PR(a[i]);
		if (a[i] == a[i+1]){
			c++;
			if (i + 2 == n){
			j -= c * (c-1)/2;
			}
		} else if(a[i] != a[i+1]){
			// PR("false");
			// PR(i);
			// PR("DEL");
			// PR(c * (c-1)/2);
			j -= c * (c-1)/2;
			c = 1;
		}

		
	}
	PR(j);

	return 0;


}
#include <bits/stdc++.h>
using namespace std;
#define ll long long

vector<long long> enum_divisors(long long N) {
    vector<long long> res;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            // 重複しないならば i の相方である N/i も push
            if (N/i != i) res.push_back(N/i);
        }
    }
    // 小さい順に並び替える
    sort(res.begin(), res.end());
    return res;
}

int main()
{
  ll N;
  cin >> N;
  vector<long long> div = enum_divisors(N*2);
  //(m+n)(m-n+1) = 2N
  ll cnt = 0;
  for(const auto& i : div){
  	//cout << i << " " << (N*2/i) << " " << (i&1) << " " << ((N*2/i)&1) << "\n";
  	if(((N*2/i)&1) != (i&1)) cnt++;
  }
  cout << cnt;
  return 0;
}

