#include <stdio.h>
#include <stdlib.h>

int main() {
    long long int t, r, b, k, i, c;
    scanf("%I64d", &t);
    for (i = 0; i < t; i++) {
        scanf("%I64d%I64d%I64d", &r, &b, &k);
        if (r > b) {
            c = r / b;
            if (r % b != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else if (b > r) {
            c = b / r;
            if (b % r != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else
            printf("OBEY\n");
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

 long long int gcd(long long int a, long long int b) {
    if (a % b == 0)
        return b;
    else if (b % a == 0)
        return a;
    return gcd(a % b, b % a);
 }
 int main() {
    long long int t, r1, b1, r, b, k, i, c, d;
    scanf("%I64d", &t);
    for (i = 0; i < t; i++) {
        scanf("%I64d%I64d%I64d", &r1, &b1, &k);
        if (r1 > b1) {
            r = r1;
            b = b1;
        }
        else {
            r = b1;
            b = r1;
        }
        d = gcd(r, b);
        c = (k - 1) * b + d;
        if (c >= r)
            printf("OBEY\n");
        else
            printf("REBEL\n");

        /*if (r > b) {
            c = r / b;
            if (r % b != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else if (b > r) {
            c = b / r;
            if (b % r != 0) {
                if (c < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
            else {
                if (c - 1 < k)
                    printf("OBEY\n");
                else
                    printf("REBEL\n");
            }
        }
        else
            printf("OBEY\n");*/
    }
    return 0;
}


#include<stdio.h>

int mygcd(int a, int b){
  if(a == 0) return b;
  return mygcd(b%a, a);
}

int main(){
  int tcases;
  scanf("%d", &tcases);
  while(tcases--){
    int r, b, k;
    scanf("%d %d %d", &r, &b, &k);
    if(r > b){ //swap
      r ^= b;
      b ^= r;
      r ^= b;
    }
    if(r == b){
      printf("OBEY\n");
      continue;
    }
    int x = mygcd(r, b);
    if((b - x) > (k-1)*1ll*r) printf("REBEL\n");
    else printf("OBEY\n");
  }
  return 0;
}


    #include<stdio.h>
    #define ll long long
    ll gcd(ll a,ll b){
    	if(!a)return b;
    	else return gcd(b%a,a);
    }
    ll max(ll a,ll b){
if(a>b) return a;
else return b;
}
ll min(ll a,ll b){
if(a<b) return a;
else return b;
}
    int main(){
    	int n;
    	scanf("%d",&n);
    	for(int i=0;i<n;++i){
    		ll a,b,c;
    		scanf("%lld %lld %lld",&a,&b,&c);
    		ll r=min(a,b);
    		ll bl=max(a,b);
    		ll g=gcd(r,bl);
    		if((g+(c-1)*r)<bl) printf("REBEL\n");
    		else printf("OBEY\n");
    	}
    }


    #include<stdio.h>
    #define ll long long
    ll gcd(ll a,ll b){
    	if(!a)return b;
    	else return gcd(b%a,a);
    }
    ll max(ll a,ll b){
if(a>b) return a;
else return b;
}
ll min(ll a,ll b){
if(a<b) return a;
else return b;
}
    int main(){
    	int n;
    	scanf("%d",&n);
    	for(int i=0;i<n;++i){
    		ll a,b,c;
    		scanf("%lld %lld %lld",&a,&b,&c);
    		ll p=gcd(a,b);
    		a/=p;
    		b/=p;
    		if(((max(a,b)-2)/min(a,b)+1)>=c)printf("REBEL\n");
    		else printf("OBEY\n");
    	}
    }


#include<stdio.h>
#define ll long long
ll max(ll a,ll b){
if(a>b) return a;
else return b;
}
ll min(ll a,ll b){
if(a<b) return a;
else return b;
}
int main(){ll n;
scanf("%lld",&n);
while(n--){
ll r,b,k;
scanf("%lld%lld%lld",&r,&b,&k);
if(max(r,b)/min(r,b)>=k) printf("REBEL\n");
else printf("OBEY\n");

}

return 0;}


#include<stdio.h>
#define ll long long
ll max(ll a,ll b){
if(a>b) return a;
else return b;
}
ll min(ll a,ll b){
if(a<b) return a;
else return b;
}
int main(){ll n;
scanf("%lld",&n);
while(n--){
ll r,b,k;
scanf("%lld%lld%lld",&r,&b,&k);
if(max(r,b)/min(r,b)==k) {if (max(r,b)%min(r,b)) printf("REBEL\n");
else printf("OBEY\n");}
else if(max(r,b)/min(r,b)>k) printf("REBEL\n");
else printf("OBEY\n");

}

return 0;}


    #include<stdio.h>
    #define ll long long
    ll gcd(ll a,ll b){
    	if(!a)return b;
    	else return gcd(b%a,a);
    }
    ll max(ll a,ll b){
if(a>b) return a;
else return b;
}
ll min(ll a,ll b){
if(a<b) return a;
else return b;
}
    int main(){
    	int n;
    	scanf("%d",&n);
    	for(int i=0;i<n;++i){
    		ll a,b,c;
    		scanf("%lld %lld %lld",&a,&b,&c);
    		ll p=gcd(a,b);
    		a/=p;
    		b/=p;
    		if(((max(a,b)-1)/min(a,b))>=c)printf("REBEL\n");
    		else printf("OBEY\n");
    	}
    }


#include <stdio.h>
int gcd(int max,int min)
{
	if(max%min==0)
		return min;
	else
	{
		int k=max/min;
		return gcd(min,max-k*min);
	}
}
int main()
{
	int t;
	scanf("%d",&t);
	int a,b,k;
	for(int i=1;i<=t;i++)
	{
		scanf("%d%d%d",&a,&b,&k);
		int max=a>b?a:b;
		int min=a+b-max;
		long lcm=(long)a*b/gcd(max,min);
		int maxNo=lcm/max;
		int p=0,n=0;
		int chk;
		int flag=1;
		for(int j=1;j<=maxNo;j++)
		{
			n=(j*max)/min;
			if(j==maxNo)
			{
				chk=n-p;
				if(chk>k)
					flag=0;
			}
			else
			{
				chk=n-p;
				if(chk>=k)
					flag=0;
				p=n;
			}
		}
		if(flag==1)
			printf("OBEY\n");
		else
			printf("REBEL\n");
	}
}


#include <stdio.h>
long gcd(long max,long min)
{
	if(max%min==0)
		return min;
	else
	{
		long k=max/min;
		return gcd(min,max-k*min);
	}
}
int main()
{
	long t;
	scanf("%ld",&t);
	long a,b,k;
	for(long i=1;i<=t;i++)
	{
		scanf("%ld%ld%ld",&a,&b,&k);
		long max=a>b?a:b;
		long min=a+b-max;
		long lcm=(long)a*b/gcd(max,min);
		long maxNo=lcm/max;
		long p=0,n=0;
		long chk;
		long flag=1;
		for(long j=1;j<=maxNo;j++)
		{
			n=(j*max)/min;
			if(j==maxNo)
			{
				chk=n-p;
				if(chk>k)
					flag=0;
			}
			else
			{
				chk=n-p;
				if(chk>=k)
					flag=0;
				p=n;
			}
		}
		if(flag==1)
			printf("OBEY\n");
		else
			printf("REBEL\n");
	}
}


#include <stdio.h>
long gcd(long max,long min)
{
	if(max%min==0)
		return min;
	else
	{
		long k=max/min;
		return gcd(min,max-k*min);
	}
}
int main()
{
	long t;
	scanf("%ld",&t);
	long a,b,k;
	for(long i=1;i<=t;i++)
	{
		scanf("%ld%ld%ld",&a,&b,&k);
		long max=a>b?a:b;
		long min=a+b-max;
		long g=gcd(max,min);
		if((1+(max-2*g)/min)>=k)
			printf("REBEL\n");
		else
			printf("OBEY\n");
	}
}


#include <stdio.h>
int gcd(int max,int min)
{
	if(max%min==0)
		return min;
	else
	{
		int k=max/min;
		return gcd(min,max-k*min);
	}
}
int main()
{
	int t;
	scanf("%d",&t);
	int a,b,k;
	for(int i=1;i<=t;i++)
	{
		scanf("%d%d%d",&a,&b,&k);
		int max=a>b?a:b;
		int min=a+b-max;
		long lcm=(long)a*b/gcd(max,min);
		printf("%ld\n",lcm);
		int maxNo=lcm/max;
		int p=0,n=0;
		int chk;
		int flag=1;
		for(int j=1;j<=maxNo;j++)
		{
			n=(j*max)/min;
			if(j==maxNo)
			{
				chk=n-p;
				if(chk>k)
					flag=0;
			}
			else
			{
				chk=n-p;
				if(chk>=k)
					flag=0;
				p=n;
			}
		}
		if(flag==1)
			printf("OBEY\n");
		else
			printf("REBEL\n");
	}
}


#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <ctime>
#include <fstream>
#include <cmath>

using namespace std;

#ifndef LOCAL
#define cerr if(0)cerr
#endif
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define RT fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vpii;
typedef vector<vi > vvi;

const int INFint = 2147483547;
const ll INF = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const ll MOD1 = 1000000009ll;

const ld EPS = 1e-13;

#define FILE "invtrans"

class SegmentTree{
public:
    int n;
    vector<int> t;

    void modify(int p, int value) {
        for (t[p += n] = value; p > 1; p >>= 1) t[p >> 1] = max(t[p], t[p ^ 1]);
    }

    int query(int l, int r) {
        int res = 0;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(t[--r], res);
        }
        return res;
    }

    SegmentTree(int n) : n(n), t(){
        t.resize(n << 1, 0);
    }
};

int main(){
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
//    freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
//        freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<pair<int, pair<int, int > > > v(n);
    multiset<pair<int, int> > x, y, z;
    for (int i = 0; i < n; i++) {
        cin >> v[i].F;
    }
    vi allx;
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.F;
        allx.pb(v[i].S.F);
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.S;
    }
    sort(allx.begin(), allx.end());
    map<int, int> compr;
    int cnt = 0;
    for (int i = 0; i < allx.size(); i++) {
        if (i == 0 || allx[i - 1] != allx[i]) {
            compr[allx[i]] = cnt;
            cnt++;
        }
    }
    SegmentTree sg(cnt);
    sort(v.begin(), v.end());
    for (int i = 0; i < n; i++) {
        v[i].S.F = compr[v[i].S.F];
//        sg.modify(v[i].S.F, v[i].S.S);
    }
    int ans = 0;
    for (int i = n - 1; i > -1; i--) {

        int x = v[i].F, y = v[i].S.F, z = v[i].S.S;
        cerr << x << ' ' << y << ' ' << z << ' ' << sg.query(y + 1, cnt) << endl;
        if (sg.query(y + 1, cnt) > z) {
            ans++;
            cerr << "kek\n";
        }
        sg.modify(y, z);

    }
    cout << ans;

    RT;
    return 0;
}


#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <ctime>
#include <fstream>
#include <cmath>

using namespace std;

#ifndef LOCAL
#define cerr if(0)cerr
#endif
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define RT fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vpii;
typedef vector<vi > vvi;

const int INFint = 2147483547;
const ll INF = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const ll MOD1 = 1000000009ll;

const ld EPS = 1e-13;

#define FILE "invtrans"

class SegmentTree{
public:
    int n;
    vector<int> t;

    void modify(int p, int value) {
        for (t[p += n] = value; p > 1; p >>= 1) t[p >> 1] = max(t[p], t[p ^ 1]);
    }

    int query(int l, int r) {
        int res = 0;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(t[--r], res);
        }
        return res;
    }

    SegmentTree(int n) : n(n), t(){
        t.resize(n << 1, 0);
    }
};

bool comp(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
    if (a.F == b.F) {
//        if (a.S.S == b.S.S) {
//            return a.S.F < b.S.F;
//        }
        return a.S.S > b.S.S;
    }
    return a < b;
}

int main(){
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
//    freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
//        freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<pair<int, pair<int, int > > > v(n);
    multiset<pair<int, int> > x, y, z;
    for (int i = 0; i < n; i++) {
        cin >> v[i].F;
    }
    vi allx;
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.F;
        allx.pb(v[i].S.F);
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.S;
    }
    sort(allx.begin(), allx.end());
    map<int, int> compr;
    int cnt = 0;
    for (int i = 0; i < allx.size(); i++) {
        if (i == 0 || allx[i - 1] != allx[i]) {
            compr[allx[i]] = cnt;
            cnt++;
        }
    }
    SegmentTree sg(cnt);
    for (int i = 0; i < n; i++) {
        v[i].S.F = compr[v[i].S.F];
//        sg.modify(v[i].S.F, v[i].S.S);
    }
    int ans = 0;
    int prev = n - 1;
    sort(v.begin(), v.end();
    for (int i = n - 1; i > -1; i--) {

        int x = v[i].F, y = v[i].S.F, z = v[i].S.S;
        cerr << x << ' ' << y << ' ' << z << ' ' << sg.query(y + 1, cnt) << endl;
        if (sg.query(y + 1, cnt) > z) {
            ans++;
            cerr << "kek\n";
        }
        if (i == 0 || v[i - 1].F == v[i].F) continue;
        for (int it = i; it <= prev; it++) {
            sg.modify(v[it].S.F, v[it].S.S);
        }
        prev = i;

    }
    cout << ans;

    RT;
    return 0;
}


 #include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <ctime>
#include <fstream>
#include <cmath>

using namespace std;

#ifndef LOCAL
#define cerr if(0)cerr
#endif
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define RT fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock()/CLOCKS_PER_SEC);

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii > vpii;
typedef vector<vi > vvi;

const int INFint = 2147483547;
const ll INF = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const ll MOD1 = 1000000009ll;

const ld EPS = 1e-13;

#define FILE "invtrans"

class SegmentTree{
public:
    int n;
    vector<int> t;

    void modify(int p, int value) {
        for (t[p += n] = value; p > 1; p >>= 1) t[p >> 1] = max(t[p], t[p ^ 1]);
    }

    int query(int l, int r) {
        int res = 0;
        for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) res = max(res, t[l++]);
            if (r & 1) res = max(t[--r], res);
        }
        return res;
    }

    SegmentTree(int n) : n(n), t(){
        t.resize(n << 1, 0);
    }
};

bool comp(pair<int, pair<int, int> > a, pair<int, pair<int, int> > b) {
    if (a.F == b.F) {
//        if (a.S.S == b.S.S) {
//            return a.S.F < b.S.F;
//        }
        return a.S.S > b.S.S;
    }
    return a < b;
}

int main(){
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#else
//    freopen(FILE".in", "r", stdin); freopen(FILE".out", "w", stdout);
    //    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector<pair<int, pair<int, int > > > v(n);
  //  multiset<pair<int, int> > x, y, z;
    for (int i = 0; i < n; i++) {
        cin >> v[i].F;
    }
    vi allx;
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.F;
        allx.pb(v[i].S.F);
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i].S.S;
    }
    sort(allx.begin(), allx.end());
    map<int, int> compr;
    int cnt = 0;
    for (int i = 0; i < allx.size(); i++) {
        if (i == 0 || allx[i - 1] != allx[i]) {
            compr[allx[i]] = cnt;
            cnt++;
        }
    }
    SegmentTree sg(cnt);
    for (int i = 0; i < n; i++) {
        v[i].S.F = compr[v[i].S.F];
//        sg.modify(v[i].S.F, v[i].S.S);
    }
    int ans = 0;
    int prev = 0;
    sort(v.begin(), v.end(), comp);
    for (int i = n - 1; i > -1; i--) {

        int x = v[i].F, y = v[i].S.F, z = v[i].S.S;
        cerr << x << ' ' << y << ' ' << z << ' ' << sg.query(y + 1, cnt) << endl;
        if (sg.query(y + 1, cnt) > z) {
            ans++;
            cerr << "kek\n";
        }
        sg.modify(y, z);

    }
    cout << ans;

    RT;
    return 0;
}


#include <stdio.h>
const int N = 5e5+10;
int a[4][N], maxx[4];
int main()
{
	int n, res;
	scanf("%d", &n);
	for(int i = 1; i <= 3; i++)
	{
		scanf("%d", &a[i][1]);
		maxx[i] = a[i][1];
		for(int j = 2; j <= n; j++){
			scanf("%d", &a[i][j]);
			if(maxx[i] < a[i][j])
				maxx[i] = a[i][j];
		}

	}

}


#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 5e5+10;
int trr[(N*3)<<2] = {0};
struct node
{
	int a, b, c;
	friend bool operator < (struct node a, struct node b)
	{
		return a.a < b.a;
	}
}a[N];
int query(int id, int l, int r, int L, int R)
{
	if(L > R) return 0;
	if(L <= l && r <= R)
	{
		return trr[id];
	}
	int mid = (l + r) / 2;
	if(L >= mid+1) return query(id<<1|1, mid+1, r, L, R);
	else if(R <= mid) return query(id<<1, l, mid, L, R);
	else return max(query(id<<1, l, mid, L,mid), query(id<<1|1, mid+1, r,mid+1, R));
}
void update(int id, int l, int r, int pos, int val)
{
	if(l==r)
	{
		trr[id] = max(trr[id], val); return;
	}
	int mid = (l + r) / 2;
	if(pos <= mid) update(id<<1, l, mid, pos, val);
	else update(id<<1|1, mid+1, r, pos, val);
	trr[id] = max(trr[id<<1], trr[id<<1|1]);
}
int main()
{
	int n, res = 0;
	vector <int> ve;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].a);
		ve.push_back(a[i].a);
	}
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].b);
		ve.push_back(a[i].b);
	}
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].c);
		ve.push_back(a[i].c);
	}
	sort(ve.begin(), ve.end());
	ve.erase(unique(ve.begin(), ve.end()), ve.end());
	for(int i = 1; i <= n; i++)
	{
		a[i].a = 1 + lower_bound(ve.begin(), ve.end(), a[i].a) - ve.begin();
		a[i].b = 1 + lower_bound(ve.begin(), ve.end(), a[i].b) - ve.begin();
		a[i].c = 1 + lower_bound(ve.begin(), ve.end(), a[i].c) - ve.begin();
	}
	int size = ve.size();
	sort(a+1, a+1+n);
	for(int i = n; i >= 1; i--)
	{
		if(query(1, 1, size, a[i].b+1, size) > a[i].c) res++;
		else update(1, 1, size, a[i].b, a[i].c);
	}
	printf("%d\n", res);
}


#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 5e5+10;
int trr[(N*3)<<2] = {0};
struct node
{
	int a, b, c;
	friend bool operator < (struct node a, struct node b)
	{
		return a.a < b.a;
	}
}a[N];
int query(int id, int l, int r, int L, int R)
{
	if(L > R) return 0;
	if(L <= l && r <= R)
	{
		return trr[id];
	}
	int mid = (l + r) / 2;
	if(L >= mid+1) return query(id<<1|1, mid+1, r, L, R);
	else if(R <= mid) return query(id<<1, l, mid, L, R);
	else return max(query(id<<1, l, mid, L,mid), query(id<<1|1, mid+1, r,mid+1, R));
}
void update(int id, int l, int r, int pos, int val)
{
	if(l==r)
	{
		trr[id] = max(trr[id], val); return;
	}
	int mid = (l + r) / 2;
	if(pos <= mid) update(id<<1, l, mid, pos, val);
	else update(id<<1|1, mid+1, r, pos, val);
	trr[id] = max(trr[id<<1], trr[id<<1|1]);
}
int main()
{
	int n, res = 0;
	vector <int> ve;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].a);
		ve.push_back(a[i].a);
	}
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].b);
		ve.push_back(a[i].b);
	}
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i].c);
		ve.push_back(a[i].c);
	}
	sort(ve.begin(), ve.end());
	ve.erase(unique(ve.begin(), ve.end()), ve.end());
	for(int i = 1; i <= n; i++)
	{
		a[i].a = 1 + lower_bound(ve.begin(), ve.end(), a[i].a) - ve.begin();
		a[i].b = 1 + lower_bound(ve.begin(), ve.end(), a[i].b) - ve.begin();
		a[i].c = 1 + lower_bound(ve.begin(), ve.end(), a[i].c) - ve.begin();
	}
	int size = ve.size();
	sort(a+1, a+1+n);
	int st = n, val = a[n].a;
	for(int i = n; i >= 1; i--)
	{
		if(a[i].a != val)
		{
			for(int j = st; j > i; j--)
				update(1, 1, size, a[j].b, a[j].c);
			val = a[i].a;
			st = i;
		}
		if(query(1, 1, size, a[i].b+1, size) > a[i].c) res++;
	}
	printf("%d\n", res);
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    // cout<<"cdq: "<<l<<" "<<r<<" with p size: "<<p.size()<<endl;
    if(l==r or p.empty() or p[0].x==p.back().x)return;
    int m=(l+r)>>1;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,-1),pl.push_back(i);
        else pr.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(p[l].x==p[r].x)return;
    int m=(l+r)>>1;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,-1),pl.push_back(i);
        else pr.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v,set<int> &s){
    for(;x<500008;x+=lb(x))bit[x]+=v,s.insert(x);
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(l==r or p.empty() or p[0].x==p.back().x)return;
    // cout<<"cdq: "<<l<<" "<<r<<" with p size: "<<p.size()<<endl;
    // cout<<"p: "; for(auto &i:p)cout<<i.i<<", "; cout<<endl;
    int m=(l+r)>>1;
    // for(auto &i:p){
    //     if(i.y>m)cout<<"for i: "<<i.i<<", i.y: "<<i.y<<" <=m: "<<m<<endl;
    // }
    set<int> chs;
    for(auto &i:p){
        if(i.y>m)add(500005-i.z,1,chs);
        else ss[i.i]|=!!qry(500005-i.z-1);// , cout<<"ss "<<i.i<<": "<<ss[i.i]<<endl;
    }
    vector<pp> pl,pr;
    for(auto &i:chs)bit[i]=0;
    for(auto &i:p){
        if(i.y>m)pr.push_back(i);
        else pl.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y==b.y?a.z<b.z:a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
    // for(int i=0;i<n;++i)if(ss[i])cout<<"i: "<<i<<", ss"<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
} ppp[500008];
bool ss[500008];
vector<pp*> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp*> &p){
    if(l==r or p.empty() or p[0]->x==p.back()->x)return;
    // cout<<"cdq: "<<l<<" "<<r<<" with p size: "<<p.size()<<endl;
    // cout<<"p: "; for(auto &i:p)cout<<i.i<<", "; cout<<endl;
    int m=(l+r)>>1;
    // for(auto &i:p){
    //     if(i.y>m)cout<<"for i: "<<i.i<<", i.y: "<<i.y<<" <=m: "<<m<<endl;
    // }
    for(auto &i:p){
        if(i->y>m)add(500005-i->z,1);
        else ss[i->i]|=!!qry(500005-i->z-1);// , cout<<"ss "<<i.i<<": "<<ss[i.i]<<endl;
    }
    vector<pp*> pl,pr;
    for(auto &i:p){
        if(i->y>m)add(500005-i->z,-1),pr.push_back(i);
        else pl.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>ppp[i].x,ppp[i].i=i,p[i]=&ppp[i];
    for(int i=0;i<n;++i)cin>>ppp[i].y,numy.push_back(ppp[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>ppp[i].z,numz.push_back(ppp[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)ppp[i].y=lower_bound(numy.begin(),numy.end(),ppp[i].y)-numy.begin();
    for(int i=0;i<n;++i)ppp[i].z=lower_bound(numz.begin(),numz.end(),ppp[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp *a,const pp *b){return a->x==b->x?a->y==b->y?a->z<b->z:a->y<b->y:a->x>b->x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
    // for(int i=0;i<n;++i)if(ss[i])cout<<"i: "<<i<<", ss"<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(p[l].x==p[r].x)return;
    int m=(l+r)>>1;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,-1),pl.push_back(i);
        else pr.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin()+1;
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(p[l].x==p[r].x)return;
    int m=(l+r)>>1;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y<=m)add(500005-i.z,-1),pl.push_back(i);
        else pr.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin();
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(l==r or p.empty() or p[0].x==p.back().x)return;
    // cout<<"cdq: "<<l<<" "<<r<<" with p size: "<<p.size()<<endl;
    // cout<<"p: "; for(auto &i:p)cout<<i.i<<", "; cout<<endl;
    int m=(l+r)>>1;
    // for(auto &i:p){
    //     if(i.y>m)cout<<"for i: "<<i.i<<", i.y: "<<i.y<<" <=m: "<<m<<endl;
    // }
    for(auto &i:p){
        if(i.y>m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);// , cout<<"ss "<<i.i<<": "<<ss[i.i]<<endl;
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y>m)add(500005-i.z,-1),pr.push_back(i);
        else pl.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y==b.y?a.z<b.z:a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
    // for(int i=0;i<n;++i)if(ss[i])cout<<"i: "<<i<<", ss"<<endl;
}


#include<bits/stdc++.h>
using namespace std;

struct pp{
    int x,y,z,i;
};
bool ss[500008];
vector<pp> p;
vector<int> numy,numz;
int bit[500008];

#define lb(x) ((x)&-(x))
void add(int x,int v){
    for(;x<500008;x+=lb(x))bit[x]+=v;
}
int qry(int x,int v=0){
    for(;x;x-=lb(x))v+=bit[x]; return v;
}

void cdq(int l,int r,vector<pp> &p){
    if(l==r or p.empty() or p[0].x==p.back().x)return;
    // cout<<"cdq: "<<l<<" "<<r<<" with p size: "<<p.size()<<endl;
    // cout<<"p: "; for(auto &i:p)cout<<i.i<<", "; cout<<endl;
    int m=(l+r)>>1;
    // for(auto &i:p){
    //     if(i.y>m)cout<<"for i: "<<i.i<<", i.y: "<<i.y<<" <=m: "<<m<<endl;
    // }
    for(auto &i:p){
        if(i.y>m)add(500005-i.z,1);
        else ss[i.i]|=!!qry(500005-i.z-1);// , cout<<"ss "<<i.i<<": "<<ss[i.i]<<endl;
    }
    vector<pp> pl,pr;
    for(auto &i:p){
        if(i.y>m)add(500005-i.z,-1),pr.push_back(i);
        else pl.push_back(i);
    }
    cdq(l,m,pl); cdq(m+1,r,pr);
}

int main(){
    int n; cin>>n; p.resize(n);
    for(int i=0;i<n;++i)cin>>p[i].x,p[i].i=i;
    for(int i=0;i<n;++i)cin>>p[i].y,numy.push_back(p[i].y); sort(numy.begin(),numy.end());
    for(int i=0;i<n;++i)cin>>p[i].z,numz.push_back(p[i].z); sort(numz.begin(),numz.end());
    for(int i=0;i<n;++i)p[i].y=lower_bound(numy.begin(),numy.end(),p[i].y)-numy.begin();
    for(int i=0;i<n;++i)p[i].z=lower_bound(numz.begin(),numz.end(),p[i].z)-numz.begin()+1;
    sort(p.begin(),p.end(),[](const pp &a,const pp &b){return a.x==b.x?a.y==b.y?a.z<b.z:a.y<b.y:a.x>b.x;});
    cdq(0,n-1,p); int ans=0;
    for(int i=0;i<n;++i)if(ss[i])++ans; cout<<ans<<endl;
    // for(int i=0;i<n;++i)if(ss[i])cout<<"i: "<<i<<", ss"<<endl;
}


// TODO : Choose an Appropriate Name!!
// We're not here because we're free. We're here because we are not free.
//											   The Matrix Reloaded (2003)
#include <bits/stdc++.h>

using namespace std;

#define MohammadAmin main()
#define mpair make_pair
#define endl "\n"
#define c_false ios_base::sync_with_stdio(false); cin.tie(0)
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define X first
#define Y second.first
#define Z second.second
#define ashar(a) cout << fixed << setprecision((a))
#define reset(a,b) memset(a, b, sizeof(a))
#define for0(a, n) for (int (a) = 0; (a) < (n); (a)++)
#define for1(a, n) for (int (a) = 1; (a) <= (n); (a)++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const int n_ = 1e5 + 1000, lg = 20;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

pair<int, pii> a[n_];
int n, ptr, ans;

struct SEG {
	pii q[lg][n_];
	int mx[lg][n_];

	SEG() {
		reset(q, 0); reset(mx, 0);
	}

	void build(int h = 0, int b = 0, int e = n) {
		if (b == e - 1) {
			q[h][b] = {a[b].Y, a[b].Z};
			mx[h][b] = a[b].Z;
			return;
		}
		int mid = b + e >> 1;
		build(h+1, b, mid), build(h+1, mid, e);
		merge(q[h+1] + b, q[h+1] + mid, q[h+1] + mid, q[h+1] + e, q[h] + b);
		for(int i = e-1; i >= b; i--) {
		   mx[h][i] = max( (i+1 == e ? 0 : mx[h][i+1]), q[h][i].second);
		}
	}

	int query(int ql, int qr, int x, int h = 0, int b = 0, int e = n) { // returns max in segment [ql, qr)
		if (ql >= e || qr <= b) return 0;
		if (ql <= b and e <= qr) {
			int id = lower_bound(q[h] + b, q[h] + e, pii(x, INF)) - q[h];
			return (id != e) * mx[h][id];
		}
		int mid = b + e >> 1;
		return max( query(ql, qr, x, h+1, b, mid), query(ql, qr, x, h+1, mid, e) );
	}

} s;

int MohammadAmin {
	c_false;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i].X;
	for(int i = 0; i < n; i++) cin >> a[i].Y;
	for(int i = 0; i < n; i++) cin >> a[i].Z;
	sort(a, a+n);
//	for(int i = 0; i < n; i++) {
//		cerr << a[i].X << " " << a[i].Y << " " << a[i].Z << endl;
//	}
	s.build();
	for(int i = 0; i < n; i++) {
		while(ptr < n && a[ptr].X == a[i].X) ptr++;
//		cerr << "--\t" << ptr << " " << i << " " << s.query(ptr, n, a[i].Y) << endl;
		if (s.query(ptr, n, a[i].Y) > a[i].Z) ans++;
	}
	cout << ans << endl;
	return 0;
}


// TODO : Choose an Appropriate Name!!
// We're not here because we're free. We're here because we are not free.
//											   The Matrix Reloaded (2003)
#include <bits/stdc++.h>

using namespace std;

#define MohammadAmin main()
#define mpair make_pair
#define endl "\n"
#define c_false ios_base::sync_with_stdio(false); cin.tie(0)
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define X first
#define Y second.first
#define Z second.second
#define ashar(a) cout << fixed << setprecision((a))
#define reset(a,b) memset(a, b, sizeof(a))
#define for0(a, n) for (int (a) = 0; (a) < (n); (a)++)
#define for1(a, n) for (int (a) = 1; (a) <= (n); (a)++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const int n_ = 5e5 + 1000, lg = 20;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

pair<int, pii> a[n_];
int n, ptr, ans;

struct SEG {
	pii q[lg][n_];
	int mx[lg][n_];

	SEG() {
		reset(q, 0); reset(mx, 0);
	}

	void build(int h = 0, int b = 0, int e = n) {
		if (b == e - 1) {
			q[h][b] = {a[b].Y, a[b].Z};
			mx[h][b] = a[b].Z;
			return;
		}
		int mid = b + e >> 1;
		build(h+1, b, mid), build(h+1, mid, e);
		merge(q[h+1] + b, q[h+1] + mid, q[h+1] + mid, q[h+1] + e, q[h] + b);
		for(int i = e-1; i >= b; i--) {
		   mx[h][i] = max( (i+1 == e ? 0 : mx[h][i+1]), q[h][i].second);
		}
	}

	int query(int ql, int qr, int x, int h = 0, int b = 0, int e = n) { // returns max in segment [ql, qr)
		if (ql >= e || qr <= b) return 0;
		if (ql <= b and e <= qr) {
			int id = lower_bound(q[h] + b, q[h] + e, pii(x, INF)) - q[h];
			return (id != e) * mx[h][id];
		}
		int mid = b + e >> 1;
		return max( query(ql, qr, x, h+1, b, mid), query(ql, qr, x, h+1, mid, e) );
	}

} s;

int MohammadAmin {
	c_false;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i].X;
	for(int i = 0; i < n; i++) cin >> a[i].Y;
	for(int i = 0; i < n; i++) cin >> a[i].Z;
	sort(a, a+n);
//	for(int i = 0; i < n; i++) {
//		cerr << a[i].X << " " << a[i].Y << " " << a[i].Z << endl;
//	}
	s.build();
	for(int i = 0; i < n; i++) {
		while(ptr < n && a[ptr].X == a[i].X) ptr++;
//		cerr << "--\t" << ptr << " " << i << " " << s.query(ptr, n, a[i].Y) << endl;
		if (s.query(ptr, n, a[i].Y) > a[i].Z) ans++;
	}
	cout << ans << endl;
	return 0;
}


// TODO : Choose an Appropriate Name!!
// We're not here because we're free. We're here because we are not free.
//											   The Matrix Reloaded (2003)
#include <bits/stdc++.h>

using namespace std;

#define MohammadAmin main()
#define mpair make_pair
#define endl "\n"
#define c_false ios_base::sync_with_stdio(false); cin.tie(0)
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define X first
#define Y second.first
#define Z second.second
#define ashar(a) cout << fixed << setprecision((a))
#define reset(a,b) memset(a, b, sizeof(a))
#define for0(a, n) for (int (a) = 0; (a) < (n); (a)++)
#define for1(a, n) for (int (a) = 1; (a) <= (n); (a)++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const int n_ = 1e5 + 1000, lg = 20;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

pair<int, pii> a[n_];
int n, ptr, ans;

struct SEG {
	pii q[lg][n_];
	int mx[lg][n_];

	SEG() {
		reset(q, 0); reset(mx, 0);
	}

	void build(int h = 0, int b = 0, int e = n) {
		if (b == e - 1) {
			q[h][b] = {a[b].Y, a[b].Z};
			mx[h][b] = a[b].Z;
			return;
		}
		int mid = b + e >> 1;
		build(h+1, b, mid), build(h+1, mid, e);
		merge(q[h+1] + b, q[h+1] + mid, q[h+1] + mid, q[h+1] + e, q[h] + b);
		for(int i = e-1; i >= b; i--) {
		   mx[h][i] = max( (i+1 == e ? 0 : mx[h][i+1]), q[h][i].second);
		}
	}

	int query(int ql, int qr, int x, int h = 0, int b = 0, int e = n) { // returns max in segment [ql, qr)
		if (ql >= e || qr <= b) return 0;
		if (ql <= b and e <= qr) {
			int id = lower_bound(q[h] + b, q[h] + e, pii(x, -1)) - q[h];
			return (id != e) * mx[h][id];
		}
		int mid = b + e >> 1;
		return max( query(ql, qr, x, h+1, b, mid), query(ql, qr, x, h+1, mid, e) );
	}

} s;

int MohammadAmin {
	c_false;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i].X;
	for(int i = 0; i < n; i++) cin >> a[i].Y;
	for(int i = 0; i < n; i++) cin >> a[i].Z;
	sort(a, a+n);
//	for(int i = 0; i < n; i++) {
//		cerr << a[i].X << " " << a[i].Y << " " << a[i].Z << endl;
//	}
	s.build();
	for(int i = 0; i < n; i++) {
		while(ptr < n && a[ptr].X == a[i].X) ptr++;
//		cerr << "--\t" << ptr << " " << i << " " << s.query(ptr, n, a[i].Y) << endl;
		if (s.query(ptr, n, a[i].Y) > a[i].Z) ans++;
	}
	cout << ans << endl;
	return 0;
}


// TODO : Choose an Appropriate Name!!
// We're not here because we're free. We're here because we are not free.
//											   The Matrix Reloaded (2003)
#include <bits/stdc++.h>

using namespace std;

#define MohammadAmin main()
#define mpair make_pair
#define endl "\n"
#define c_false ios_base::sync_with_stdio(false); cin.tie(0)
#define pushb push_back
#define pushf push_front
#define popb pop_back
#define popf pop_front
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define X first
#define Y second.first
#define Z second.second
#define ashar(a) cout << fixed << setprecision((a))
#define reset(a,b) memset(a, b, sizeof(a))
#define for0(a, n) for (int (a) = 0; (a) < (n); (a)++)
#define for1(a, n) for (int (a) = 1; (a) <= (n); (a)++)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
const int n_ = 1e5 + 1000, lg = 20;
ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

pair<int, pii> a[n_];
int n, ptr, ans;

struct SEG {
	pii q[lg][n_];
	int mx[lg][n_];

	SEG() {
		reset(q, 0); reset(mx, 0);
	}

	void build(int h = 0, int b = 0, int e = n) {
		if (b == e - 1) {
			q[h][b] = {a[b].Y, a[b].Z};
			mx[h][b] = a[b].Z;
			return;
		}
		int mid = b + e >> 1;
		build(h+1, b, mid), build(h+1, mid, e);
		merge(q[h+1] + b, q[h+1] + mid, q[h+1] + mid, q[h+1] + e, q[h] + b);
		for(int i = e-1; i >= b; i--) {
		   mx[h][i] = max( (i+1 == e ? 0 : mx[h][i+1]), q[h][i].second);
		}
	}

	int query(int ql, int qr, int x, int h = 0, int b = 0, int e = n) { // returns max in segment [ql, qr)
		if (ql >= e || qr <= b) return 0;
		if (ql <= b and e <= qr) {
			int id = lower_bound(q[h] + b, q[h] + e, pii(x, -1)) - q[h];
			return (id != e) * mx[h][id];
		}
		int mid = b + e >> 1;
		return max( query(ql, qr, x, h+1, b, mid), query(ql, qr, x, h+1, mid, e) );
	}

} s;

int MohammadAmin {
	c_false;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i].X;
	for(int i = 0; i < n; i++) cin >> a[i].Y;
	for(int i = 0; i < n; i++) cin >> a[i].Z;
//	sort(a, a+n);
//	for(int i = 0; i < n; i++) {
//		cerr << a[i].X << " " << a[i].Y << " " << a[i].Z << endl;
//	}
	s.build();
	for(int i = 0; i < n; i++) {
		while(ptr < n && a[ptr].X == a[i].X) ptr++;
//		cerr << "--\t" << ptr << " " << i << " " << s.query(ptr, n, a[i].Y) << endl;
		if (s.query(ptr, n, a[i].Y) > a[i].Z) ans++;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

struct p {
	int a[ 10 ];
	int n = 0;
};
p a[ 200000 ];
int b[ 200010 ];

bool cmp( const p &a, const p &b ) {
	if( a.n == b.n ) {
		for( int i = 0; i < a.n; ++i ) {
			if( a.a[ i ] == b.a[ i ] )
				continue;
			return a.a[ i ] < b.a[ i ];
		}
		return false;
	}
	return a.n < b.n;
}

bool eql( p, p );

int main() {
	int n, k;
	int x, tmp;
	p lst;
	ll num, ans = 0;
	scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i ) {
		scanf( "%d", &x );
		++b[ x ];
		for( int j = 2; j * j <= x; ++j ) {
			tmp = 0;
			while( x % j == 0 ) {
				x /= j;
				++tmp;
			}
			if( tmp & 1 )
				a[ i ].a[ a[ i ].n++ ] = j;
		}
		if( x > 1 )
			a[ i ].a[ a[ i ].n++ ] = x;
	}
	sort( a, a + n, cmp );
	if( k == 2 ) {
		num = 1;
		lst = a[ 0 ];
		for( int i = 1; i < n; ++i ) {
			if( eql( lst, a[ i ] ) )
				++num;
			else {
				if( num > 1 )
					ans += num * ( num - 1 ) / 2;
				num = 1;
				lst = a[ i ];
			}
		}
		if( num > 1 )
			ans += num * ( num - 1 ) / 2;
	} else {
		ll fk = 1;
		while( true ) {
			ll i = 1;
			for( int w = 0; w < k; ++w )
				i *= fk;
			if( i > 10000000000 )
				break;
			for( ll j = 1; j * j <= i && j <= 100000 && i / j <= 100000; ++j ) {
				if( j * j == i ) {
					if( b[ j ] > 1 )
						ans += b[ j ] * ( b[ j ] - 1 ) / 2;
				} else {
					ans += b[ j ] * b[ i / j ];
				}
			}
			++fk;
		}
	}
	printf( "%lld", ans );
	return 0;
}

bool eql( p a, p b ) {
	if( a.n != b.n )
		return false;
	for( int i = 0; i < a.n; ++i )
		if( a.a[ i ] != b.a[ i ] )
			return false;
	return true;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

struct p {
	int a[ 10 ];
	int n = 0;
};
p a[ 200000 ];
ll b[ 200010 ];

bool cmp( const p &a, const p &b ) {
	if( a.n == b.n ) {
		for( int i = 0; i < a.n; ++i ) {
			if( a.a[ i ] == b.a[ i ] )
				continue;
			return a.a[ i ] < b.a[ i ];
		}
		return false;
	}
	return a.n < b.n;
}

bool eql( p, p );

int main() {
	bool fin = false;
	int n, k;
	int x, tmp;
	p lst;
	ll num, ans = 0;
	scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i ) {
		scanf( "%d", &x );
		++b[ x ];
		for( int j = 2; j * j <= x; ++j ) {
			tmp = 0;
			while( x % j == 0 ) {
				x /= j;
				++tmp;
			}
			if( tmp & 1 )
				a[ i ].a[ a[ i ].n++ ] = j;
		}
		if( x > 1 )
			a[ i ].a[ a[ i ].n++ ] = x;
	}
	sort( a, a + n, cmp );
	if( k == 2 ) {
		num = 1;
		lst = a[ 0 ];
		for( int i = 1; i < n; ++i ) {
			if( eql( lst, a[ i ] ) )
				++num;
			else {
				if( num > 1 )
					ans += num * ( num - 1 ) / 2;
				num = 1;
				lst = a[ i ];
			}
		}
		if( num > 1 )
			ans += num * ( num - 1 ) / 2;
	} else {
		ll fk = 1;
		while( !fin ) {
			ll i = 1;
			for( int w = 0; w < k; ++w ) {
				i *= fk;
				if( i > 10000000000 ) {
					fin = true;
					break;
				}
			}
			if( fin )
				break;
			for( ll j = 1; j * j <= i && j <= 100000; ++j ) {
				if( i % j || i / j > 100000 )
					continue;
				if( j * j == i ) {
					if( b[ j ] > 1 )
						ans += b[ j ] * ( b[ j ] - 1 ) / 2;
				} else {
					ans += b[ j ] * b[ i / j ];
				}
			}
			++fk;
		}
	}
	printf( "%lld", ans );
	return 0;
}

bool eql( p a, p b ) {
	if( a.n != b.n )
		return false;
	for( int i = 0; i < a.n; ++i )
		if( a.a[ i ] != b.a[ i ] )
			return false;
	return true;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

struct p {
	int a[ 10 ];
	int n = 0;
};
p a[ 200000 ];
ll b[ 200010 ];

bool cmp( const p &a, const p &b ) {
	if( a.n == b.n ) {
		for( int i = 0; i < a.n; ++i ) {
			if( a.a[ i ] == b.a[ i ] )
				continue;
			return a.a[ i ] < b.a[ i ];
		}
		return false;
	}
	return a.n < b.n;
}

bool eql( p, p );

int main() {
	int n, k;
	int x, tmp;
	p lst;
	ll num, ans = 0;
	scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i ) {
		scanf( "%d", &x );
		++b[ x ];
		for( int j = 2; j * j <= x; ++j ) {
			tmp = 0;
			while( x % j == 0 ) {
				x /= j;
				++tmp;
			}
			if( tmp & 1 )
				a[ i ].a[ a[ i ].n++ ] = j;
		}
		if( x > 1 )
			a[ i ].a[ a[ i ].n++ ] = x;
	}
	sort( a, a + n, cmp );
	if( k == 2 ) {
		num = 1;
		lst = a[ 0 ];
		for( int i = 1; i < n; ++i ) {
			if( eql( lst, a[ i ] ) )
				++num;
			else {
				if( num > 1 )
					ans += num * ( num - 1 ) / 2;
				num = 1;
				lst = a[ i ];
			}
		}
		if( num > 1 )
			ans += num * ( num - 1 ) / 2;
	} else {
		ll fk = 1;
		while( true ) {
			ll i = 1;
			for( int w = 0; w < k; ++w )
				i *= fk;
			if( i > 10000000000 )
				break;
			for( ll j = 1; j * j <= i && j <= 100000 && i / j <= 100000; ++j ) {
				if( i % j )
					continue;
				if( j * j == i ) {
					if( b[ j ] > 1 )
						ans += b[ j ] * ( b[ j ] - 1 ) / 2;
				} else {
					ans += b[ j ] * b[ i / j ];
				}
			}
			++fk;
		}
	}
	printf( "%lld", ans );
	return 0;
}

bool eql( p a, p b ) {
	if( a.n != b.n )
		return false;
	for( int i = 0; i < a.n; ++i )
		if( a.a[ i ] != b.a[ i ] )
			return false;
	return true;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

struct p {
	int a[ 10 ];
	int n = 0;
};
p a[ 200000 ];
ll b[ 200010 ];

bool cmp( const p &a, const p &b ) {
	if( a.n == b.n ) {
		for( int i = 0; i < a.n; ++i ) {
			if( a.a[ i ] == b.a[ i ] )
				continue;
			return a.a[ i ] < b.a[ i ];
		}
		return false;
	}
	return a.n < b.n;
}

bool eql( p, p );

int main() {
	int n, k;
	int x, tmp;
	p lst;
	ll num, ans = 0;
	scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i ) {
		scanf( "%d", &x );
		++b[ x ];
		for( int j = 2; j * j <= x; ++j ) {
			tmp = 0;
			while( x % j == 0 ) {
				x /= j;
				++tmp;
			}
			if( tmp & 1 )
				a[ i ].a[ a[ i ].n++ ] = j;
		}
		if( x > 1 )
			a[ i ].a[ a[ i ].n++ ] = x;
	}
	sort( a, a + n, cmp );
	if( k == 2 ) {
		num = 1;
		lst = a[ 0 ];
		for( int i = 1; i < n; ++i ) {
			if( eql( lst, a[ i ] ) )
				++num;
			else {
				if( num > 1 )
					ans += num * ( num - 1 ) / 2;
				num = 1;
				lst = a[ i ];
			}
		}
		if( num > 1 )
			ans += num * ( num - 1 ) / 2;
	} else {
		ll fk = 1;
		while( true ) {
			ll i = 1;
			for( int w = 0; w < k; ++w )
				i *= fk;
			if( i > 10000000000 )
				break;
			for( ll j = 1; j * j <= i && j <= 100000; ++j ) {
				if( i % j || i / j > 100000 )
					continue;
				if( j * j == i ) {
					if( b[ j ] > 1 )
						ans += b[ j ] * ( b[ j ] - 1 ) / 2;
				} else {
					ans += b[ j ] * b[ i / j ];
				}
			}
			++fk;
		}
	}
	printf( "%lld", ans );
	return 0;
}

bool eql( p a, p b ) {
	if( a.n != b.n )
		return false;
	for( int i = 0; i < a.n; ++i )
		if( a.a[ i ] != b.a[ i ] )
			return false;
	return true;
}


#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x7f
#define MAX_INF_VAL 0x7f7f7f7f
#define pi 3.141592653589
#define eps 1e-10
//#define p 2173412051LL
#define sz 2

using namespace std;

struct p {
	int a[ 10 ];
	int n = 0;
};
p a[ 200000 ];
int b[ 200010 ];

bool cmp( const p &a, const p &b ) {
	if( a.n == b.n ) {
		for( int i = 0; i < a.n; ++i ) {
			if( a.a[ i ] == b.a[ i ] )
				continue;
			return a.a[ i ] < b.a[ i ];
		}
		return false;
	}
	return a.n < b.n;
}

bool eql( p, p );

int main() {
	int n, k;
	int x, tmp;
	p lst;
	ll num, ans = 0;
	scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i ) {
		scanf( "%d", &x );
		++b[ x ];
		for( int j = 2; j * j <= x; ++j ) {
			tmp = 0;
			while( x % j == 0 ) {
				x /= j;
				++tmp;
			}
			if( tmp & 1 )
				a[ i ].a[ a[ i ].n++ ] = j;
		}
		if( x > 1 )
			a[ i ].a[ a[ i ].n++ ] = x;
	}
	sort( a, a + n, cmp );
	if( k == 2 ) {
		num = 1;
		lst = a[ 0 ];
		for( int i = 1; i < n; ++i ) {
			if( eql( lst, a[ i ] ) )
				++num;
			else {
				if( num > 1 )
					ans += num * ( num - 1 ) / 2;
				num = 1;
				lst = a[ i ];
			}
		}
		if( num > 1 )
			ans += num * ( num - 1 ) / 2;
	} else {
		ll fk = 1;
		while( true ) {
			ll i = 1;
			for( int w = 0; w < k; ++w )
				i *= fk;
			if( i > 10000000000 )
				break;
			for( ll j = 1; j * j <= i && j <= 100000 && i / j <= 100000; ++j ) {
				if( i % j )
					continue;
				if( j * j == i ) {
					if( b[ j ] > 1 )
						ans += b[ j ] * ( b[ j ] - 1 ) / 2;
				} else {
					ans += b[ j ] * b[ i / j ];
				}
			}
			++fk;
		}
	}
	printf( "%lld", ans );
	return 0;
}

bool eql( p a, p b ) {
	if( a.n != b.n )
		return false;
	for( int i = 0; i < a.n; ++i )
		if( a.a[ i ] != b.a[ i ] )
			return false;
	return true;
}


#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
inline ll kpow(ll a,int b){
	ll res=1;
	for (;a<maxn&&b;a*=a,b>>=1){
		if (b&1)	res*=a;
		if (res>=maxn)	return 0;
	}
	return res;
}
int minp[maxn];
void init(){
	for (int i=2;i<maxn;++i){
		if (minp[i])
			continue;
		for (int j=i;j<maxn;j+=i)
			if (!minp[j])
				minp[j]=i;
	}
}
inline P fac(int x,int k){
	P res=mp(1,1);
	while (x>1){
		int p=minp[x],cnt=0;
		while (x%p==0)
			cnt++,x/=p;
		res.fi*=kpow(p,cnt%k);
		res.se*=kpow(p,((k-cnt)%k+k)%k);
		if (res.se>=maxn)	res.se=0;
	}
	return res;
}
int a[maxn],cnt[maxn];
int main()
{
	init();
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		P p=fac(a[i],k);//dd(a[i]),dd(p.fi),de(p.se);
		ans+=cnt[p.se];
		cnt[p.fi]++;
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
inline ll kpow(ll a,int b){
	ll res=1;
	for (;b;a*=a,b>>=1){
		if (a>=maxn)	return 0;
		if (b&1)	res*=a;
		if (res>=maxn)	return 0;
	}
	return res;
}
int minp[maxn];
void init(){
	for (int i=2;i<maxn;++i){
		if (minp[i])
			continue;
		for (int j=i;j<maxn;j+=i)
			if (!minp[j])
				minp[j]=i;
	}
}
inline P fac(int x,int k){
	P res=mp(1,1);
	while (x>1){
		int p=minp[x],cnt=0;
		while (x%p==0)
			cnt++,x/=p;
		res.fi*=kpow(p,cnt%k);
		res.se*=kpow(p,((k-cnt)%k+k)%k);
		if (res.se>=maxn)	res.se=0;
	}
	return res;
}
int a[maxn],cnt[maxn];
int main()
{
	init();
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		P p=fac(a[i],k);//dd(a[i]),dd(p.fi),de(p.se);
		ans+=cnt[p.se];
		cnt[p.fi]++;
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
inline int kpow(ll a,int b){
	ll res=1;
	for (;a<maxn&&b;a*=a,b>>=1){
		if (b&1)	res*=a;
		if (res>=maxn)	return 0;
	}
	return res;
}
int minp[maxn];
void init(){
	for (int i=2;i<maxn;++i){
		if (minp[i])
			continue;
		for (int j=i;j<maxn;j+=i)
			if (!minp[j])
				minp[j]=i;
	}
}
inline P fac(int x,int k){
	P res=mp(1,1);
	while (x>1){
		int p=minp[x],cnt=0;
		while (x%p==0)
			cnt++,x/=p;
		res.fi*=kpow(p,cnt%k);
		res.se*=kpow(p,((k-cnt)%k+k)%k);
	}
	return res;
}
int a[maxn],cnt[maxn];
int main()
{
	init();
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		P p=fac(a[i],k);//dd(a[i]),dd(p.fi),de(p.se);
		ans+=cnt[p.se];
		cnt[p.fi]++;
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
inline int kpow(ll a,int b){
	ll res=1;
	for (;b;b>>=1){
		if (b&1)	res*=a;
		a*=a;
		if (res>=maxn||a>=maxn)	return 0;
	}
	return res;
}
int minp[maxn];
void init(){
	for (int i=2;i<maxn;++i){
		if (minp[i])
			continue;
		for (int j=i;j<maxn;j+=i)
			if (!minp[j])
				minp[j]=i;
	}
}
inline P fac(int x,int k){
	P res=mp(1,1);
	while (x>1){
		int p=minp[x],cnt=0;
		while (x%p==0)
			cnt++,x/=p;
		res.fi*=kpow(p,cnt%k);
		res.se*=kpow(p,((k-cnt)%k+k)%k);
	}
	return res;
}
int a[maxn],cnt[maxn];
int main()
{
	init();
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for (int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		P p=fac(a[i],k);//dd(a[i]),dd(p.fi),de(p.se);
		ans+=cnt[p.se];
		cnt[p.fi]++;
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=1e5+10,mod=1e9+7,INF=0x3f3f3f3f;
inline int kpow(ll a,int b){
	ll res=1;
	while (b){
		if (res>=maxn||a>=maxn)
			return 0;
		if (b&1)	res=res*a;
		a=a*a;
		b>>=1;
	}
	return res<maxn?res:0;
}
vector<int> p;
int a[maxn],cnt[maxn];
int main()
{
	int n,k;
	cin>>n>>k;
	for (int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	for (int i=1;;++i){
		int t;
		if (t=kpow(i,k))
			p.pb(t);
		else
			break;
	}
	ll ans=0;
	for (int i=n;i;--i){
		for (auto j:p)
			if (j%a[i]==0)
				ans+=cnt[j/a[i]];
		cnt[a[i]]++;
	}
	cout<<ans;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <long long> primes;

void sieve()
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

long long get_complement(long long n, long long power)
{
    long long complement = 1;
    //cout << "N = " << n << "\n";

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(primes[i]*primes[i] > n)
        {
            break;
        }

        if(n%primes[i] != 0)
        {
            continue;
        }

        //cout << "P = " << primes[i] << "\n";
        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        while(exponent%power != 0)
        {
            exponent++;

            if(complement > oo/primes[i])
            {
                complement = -1;

                return -1;
            }
            else
            {
                complement *= primes[i];
            }
        }
    }

    if(n == 1)
    {
        return complement;
    }

    //cout << "P_n = " << n << "\n";
    int exponent = 1;

    while(exponent%power != 0)
    {
        exponent++;

        if(complement > oo/n)
        {
            complement = -1;

            return -1;
        }
        else
        {
            complement *= n;
        }
    }

    return complement;
}

int main()
{
    sieve();

    int no_of_elements, power;
    scanf("%d %d", &no_of_elements, &power);

    vector <long long> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);

        for(int j = 0; j < primes.size(); j++)
        {
            if(A[i]%primes[j] != 0)
            {
                continue;
            }

            int exponent = 0;

            while(A[i]%primes[j] == 0)
            {
                A[i] /= primes[j];

                exponent++;
            }

            exponent %= power;

            for(int e = 1; e <= exponent; e++)
            {
                A[i] *= primes[j];
            }
        }
    }

    long long answer = 0, perfect_powers = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = get_complement(A[i], power);

        answer += frequency[complement];

        frequency[A[i]]++;

        /*//printf("i = %d and complement = %I64d\n", i, complement);
        //cout << "i = " << i << " Complement = " << complement << "\n";

        for(int j = 0; j < perfect.size(); j++)
        {
            if(complement == -1 || complement > oo/perfect[j])
            {
                break;
            }
            else
            {
                if(frequency[complement*perfect[j]] == 0)
                {
                    continue;
                }

                //cout << "Add Frequency of " << complement*perfect[j] << " = " << frequency[complement*perfect[j]] << "\n";
                answer += frequency[complement*perfect[j]];
            }
        }

        frequency[A[i]]++; //cout << "Frequency " << A[i] << " = " << frequency[A[i]] << "\n";*/
    }

    printf("%I64d\n", answer);
    return 0;
}


#include <iostream>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <int> primes;

void sieve(vector <int> &primes, int N)
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

long long choose_2(long long n)
{
    return (n*(n - 1))/2;
}

int is_perfect_power(long long n, int k)
{
    if(n == 1)
    {
        return true;
    }

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        if(exponent%k != 0)
        {
            return false;
        }
    }

    return true;
}

int main()
{
    sieve(primes, N);

    int no_of_elements, power;
    cin >> no_of_elements >> power;

    vector <int> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        cin >> A[i];
    }

    map <int, int> is_perfect;
    vector <int> perfect;
    for(long long n = 1; n*n <= oo ; n++)
    {
        long long product = 1;
        for(int k = 1; k <= power; k++)
        {
            if(product > oo/n)
            {
                product = -1;
                break;
            }
            else
            {
                product *= n;
            }
        }

        if(product != -1)
        {
            perfect.push_back(product);

            is_perfect[product] = true;
        }
    }

    long long answer = 0, perfect_powers = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = 1, current = A[i];

        for(int j = 0; j < primes.size(); j++)
        {
            if(current%primes[j] != 0)
            {
                continue;
            }

            int exponent = 0;

            while(current%primes[j] == 0)
            {
                current /= primes[j];

                exponent++;
            }
            //cout << "P = " << primes[j] << " and Exponent = " << exponent << "\n";
            while(exponent%power != 0)
            {
                exponent++;

                if(complement > oo/primes[j])
                {
                    complement = -1;
                }
                else
                {
                    complement *= primes[j];
                }

                //cout << "Complement = " << complement << "\n";
            }
        }

        //cout << "i = " << i << " Complement = " << complement << "\n";

        for(int j = 0; j < perfect.size(); j++)
        {
            if(complement == -1 || complement > oo/perfect[j])
            {
                break;
            }
            else
            {
                if(frequency[complement*perfect[j]] == 0)
                {
                    continue;
                }

                //cout << "Add Frequency of " << complement*perfect[j] << " = " << frequency[complement*perfect[j]] << "\n";
                answer += frequency[complement*perfect[j]];
            }
        }

        frequency[A[i]]++; //cout << "Frequency " << A[i] << " = " << frequency[A[i]] << "\n";
    }

    cout << answer << "\n";
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <long long> primes;

void sieve()
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

void get_factors(vector <pair <int, int> > &F, long long &n)
{
    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        F.push_back(make_pair(primes[i], exponent));
    }

    if(n > 1)
    {
        F.push_back(make_pair(n, 1));

        n /= n;
    }
}

long long get_complement(long long n, long long power)
{
    long long complement = 1;

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(primes[i]*primes[i] > n)
        {
            break;
        }

        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        while(exponent%power != 0)
        {
            exponent++;

            if(complement > oo/primes[i])
            {
                complement = -1;

                return -1;
            }
            else
            {
                complement *= primes[i];
            }
        }
    }

    if(n == 1)
    {
        return complement;
    }

    int exponent = 1;

    while(exponent%power != 0)
    {
        exponent++;

        if(complement > oo/n)
        {
            complement = -1;

            return -1;
        }
        else
        {
            complement *= n;
        }
    }

    return complement;
}

int main()
{
    sieve();

    int no_of_elements, power;
    scanf("%d %d", &no_of_elements, &power);

    vector <long long> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%I64d", &A[i]);

        vector <pair <int, int> > factors;

        get_factors(factors, A[i]);

        for(int f = 0; f < factors.size(); f++)
        {
            int p = factors[f].first;
            int exponent = (factors[f].second)%power;

            for(int e = 1; e <= exponent; e++)
            {
                A[i] *= p;
            }
        }
    }

    long long answer = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = get_complement(A[i], power);

        answer += frequency[complement];

        frequency[A[i]]++;
    }

    printf("%I64d\n", answer);
    return 0;
}


#include <cstdio>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <int> primes;

void sieve()
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

long long choose_2(long long n)
{
    return (n*(n - 1))/2;
}

int is_perfect_power(long long n, int k)
{
    if(n == 1)
    {
        return true;
    }

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        if(exponent%k != 0)
        {
            return false;
        }
    }

    return true;
}

int main()
{
    sieve();

    int no_of_elements, power;
    scanf("%d %d", &no_of_elements, &power);

    vector <int> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);
    }

    map <long long, int> is_perfect;
    vector <long long> perfect;
    for(long long n = 1; n*n <= oo ; n++)
    {
        long long product = 1;
        for(int k = 1; k <= power; k++)
        {
            if(product > oo/n)
            {
                product = -1;
                break;
            }
            else
            {
                product *= n;
            }
        }

        if(product != -1)
        {
            perfect.push_back(product);

            is_perfect[product] = true;
        }
    }

    long long answer = 0, perfect_powers = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = 1, current = A[i];

        for(int j = 0; current > 1 && complement >= 1 && j < primes.size(); j++)
        {
            if(current%primes[j] != 0)
            {
                continue;
            }

            int exponent = 0;

            while(current%primes[j] == 0)
            {
                current /= primes[j];

                exponent++;
            }
            //cout << "P = " << primes[j] << " and Exponent = " << exponent << "\n";
            while(exponent%power != 0)
            {
                exponent++;

                if(complement > oo/primes[j])
                {
                    complement = -1;

                    break;
                }
                else
                {
                    complement *= primes[j];
                }

                //cout << "Complement = " << complement << "\n";
            }
        }

        //cout << "i = " << i << " Complement = " << complement << "\n";

        for(int j = 0; j < perfect.size(); j++)
        {
            if(complement == -1 || complement > oo/perfect[j])
            {
                break;
            }
            else
            {
                if(frequency[complement*perfect[j]] == 0)
                {
                    continue;
                }

                //cout << "Add Frequency of " << complement*perfect[j] << " = " << frequency[complement*perfect[j]] << "\n";
                answer += frequency[complement*perfect[j]];
            }
        }

        frequency[A[i]]++; //cout << "Frequency " << A[i] << " = " << frequency[A[i]] << "\n";
    }

    printf("%I64d\n", answer);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <long long> primes;

void sieve()
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

long long choose_2(long long n)
{
    return (n*(n - 1))/2;
}

int is_perfect_power(long long n, int k)
{
    if(n == 1)
    {
        return true;
    }

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        if(exponent%k != 0)
        {
            return false;
        }
    }

    return true;
}

long long get_complement(long long n, long long power)
{
    long long complement = 1;
    //cout << "N = " << n << "\n";

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(primes[i]*primes[i] > n)
        {
            break;
        }

        if(n%primes[i] != 0)
        {
            continue;
        }

        //cout << "P = " << primes[i] << "\n";
        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        while(exponent%power != 0)
        {
            exponent++;

            if(complement > oo/primes[i])
            {
                complement = -1;

                return -1;
            }
            else
            {
                complement *= primes[i];
            }
        }
    }

    if(n == 1)
    {
        return complement;
    }

    //cout << "P_n = " << n << "\n";
    int exponent = 1;

    while(exponent%power != 0)
    {
        exponent++;

        if(complement > oo/n)
        {
            complement = -1;

            return -1;
        }
        else
        {
            complement *= n;
        }
    }

    return complement;
}

int main()
{
    sieve();

    int no_of_elements, power;
    scanf("%d %d", &no_of_elements, &power);

    vector <int> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);
    }

    map <long long, int> is_perfect;
    vector <long long> perfect;
    for(long long n = 1; n*n <= oo ; n++)
    {
        long long product = 1;
        for(int k = 1; k <= power; k++)
        {
            if(product > oo/n)
            {
                product = -1;
                break;
            }
            else
            {
                product *= n;
            }
        }

        if(product != -1)
        {
            perfect.push_back(product);

            is_perfect[product] = true;
        }
    }

    long long answer = 0, perfect_powers = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = get_complement(A[i], power);

        //printf("i = %d and complement = %I64d\n", i, complement);
        //cout << "i = " << i << " Complement = " << complement << "\n";

        for(int j = 0; j < perfect.size(); j++)
        {
            if(complement == -1 || complement > oo/perfect[j])
            {
                break;
            }
            else
            {
                if(frequency[complement*perfect[j]] == 0)
                {
                    continue;
                }

                //cout << "Add Frequency of " << complement*perfect[j] << " = " << frequency[complement*perfect[j]] << "\n";
                answer += frequency[complement*perfect[j]];
            }
        }

        frequency[A[i]]++; //cout << "Frequency " << A[i] << " = " << frequency[A[i]] << "\n";
    }

    printf("%I64d\n", answer);
    return 0;
}


#include <cstdio>
#include <vector>
#include <map>

using namespace std;

const int N = 1e5 + 5;
const long long oo = 1e10;
vector <int> primes;

void sieve(vector <int> &primes, int N)
{
    vector <int> is_prime(N + 1, true);
    is_prime[0] = is_prime[1] = false;

    for(int i = 2; i < N; i++)
    {
        if(is_prime[i])
        {
            primes.push_back(i);
        }

        for(int j = 0; j < primes.size() && i*primes[j] < N; j++)
        {
            is_prime[i*primes[j]] = false;

            if(primes[j]%i == 0)
            {
                break;
            }
        }
    }
}

long long choose_2(long long n)
{
    return (n*(n - 1))/2;
}

int is_perfect_power(long long n, int k)
{
    if(n == 1)
    {
        return true;
    }

    for(int i = 0; n > 1 && i < primes.size(); i++)
    {
        if(n%primes[i] != 0)
        {
            continue;
        }

        int exponent = 0;

        while(n%primes[i] == 0)
        {
            n /= primes[i];

            exponent++;
        }

        if(exponent%k != 0)
        {
            return false;
        }
    }

    return true;
}

int main()
{
    sieve(primes, N);

    int no_of_elements, power;
    scanf("%d %d", &no_of_elements, &power);

    vector <int> A(no_of_elements + 1);
    for(int i = 1; i <= no_of_elements; i++)
    {
        scanf("%d", &A[i]);
    }

    map <int, int> is_perfect;
    vector <int> perfect;
    for(long long n = 1; n*n <= oo ; n++)
    {
        long long product = 1;
        for(int k = 1; k <= power; k++)
        {
            if(product > oo/n)
            {
                product = -1;
                break;
            }
            else
            {
                product *= n;
            }
        }

        if(product != -1)
        {
            perfect.push_back(product);

            is_perfect[product] = true;
        }
    }

    long long answer = 0, perfect_powers = 0;
    map <long long, int> frequency;
    for(int i = 1; i <= no_of_elements; i++)
    {
        long long complement = 1, current = A[i];

        for(int j = 0; current > 1 && complement >= 1 && j < primes.size(); j++)
        {
            if(current%primes[j] != 0)
            {
                continue;
            }

            int exponent = 0;

            while(current%primes[j] == 0)
            {
                current /= primes[j];

                exponent++;
            }
            //cout << "P = " << primes[j] << " and Exponent = " << exponent << "\n";
            while(exponent%power != 0)
            {
                exponent++;

                if(complement > oo/primes[j])
                {
                    complement = -1;

                    break;
                }
                else
                {
                    complement *= primes[j];
                }

                //cout << "Complement = " << complement << "\n";
            }
        }

        //cout << "i = " << i << " Complement = " << complement << "\n";

        for(int j = 0; j < perfect.size(); j++)
        {
            if(complement == -1 || complement > oo/perfect[j])
            {
                break;
            }
            else
            {
                if(frequency[complement*perfect[j]] == 0)
                {
                    continue;
                }

                //cout << "Add Frequency of " << complement*perfect[j] << " = " << frequency[complement*perfect[j]] << "\n";
                answer += frequency[complement*perfect[j]];
            }
        }

        frequency[A[i]]++; //cout << "Frequency " << A[i] << " = " << frequency[A[i]] << "\n";
    }

    printf("%I64d\n", answer);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	res nv=v;
	For(i,1,V[x]){
		nv*=A[x];
		if(y/nv==nv)w+=1ll*C[nv]*(C[nv]-1)/2;
		else w+=1ll*C[nv]*C[y/nv];
		dfs(x+1,nv);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],m=max(m,1ll*x);
	m*=m;
	For(i,1,m){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
	}
	cout<<w;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x,r;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	dfs(x+1,v);
	For(i,1,V[x]){
		v*=A[x];
		if(v<=r&&y/v<=r)if(y/v==v)w+=1ll*C[v]*(C[v]-1);
		else w+=1ll*C[v]*C[y/v];
		dfs(x+1,v);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],r=max(r,x);
	m=1ll*r*r;
	For(i,1,r){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
		if(y<=r)if(y!=1)w+=1ll*C[1]*C[y];
		else w+=1ll*C[1]*(C[1]-1);
	}
	cout<<w/2;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	res nv=v;
	For(i,1,V[x]){
		nv*=A[x];
		if(1ll*nv*nv>y)break;
		if(y/nv==nv)w+=1ll*C[nv]*(C[nv]-1)/2;
		else w+=1ll*C[nv]*C[y/nv];
		dfs(x+1,nv);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],m=max(m,1ll*x);
	m*=m;
	For(i,1,m){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
	}
	cout<<w;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x,r;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	dfs(x+1,v);
	For(i,1,V[x]){
		v*=A[x];
		if(v<=r&&y/v<=r)if(y/v==v)w+=1ll*C[v]*(C[v]-1);
		else w+=1ll*C[v]*C[y/v];
		dfs(x+1,v);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],r=max(r,x);
	m=r*r;
	For(i,1,m){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
		if(y<=r)if(y!=1)w+=1ll*C[1]*C[y];
		else w+=1ll*C[1]*(C[1]-1);
	}
	cout<<w/2;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x,r;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	dfs(x+1,v);
	For(i,1,V[x]){
		v*=A[x];
		if(v<=r&&y/v<=r)if(y/v==v)w+=1ll*C[v]*(C[v]-1);
		else w+=1ll*C[v]*C[y/v];
		dfs(x+1,v);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],r=max(r,x);
	m=1ll*r*r;
	For(i,1,m){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
		if(y<=r)if(y!=1)w+=1ll*C[1]*C[y];
		else w+=1ll*C[1]*(C[1]-1);
	}
	cout<<w/2;
}


#include<bits/stdc++.h>
using namespace std;
#define res register int
#define For(i,l,r) for(res i=(l),_=(r);i<=_;++i)
#define Dor(i,l,r) for(res i=(r),_=(l);i>=_;--i)
#define Sor(i,l,r) for(res i=(l),_=(r);i<_;++i)
#define Tor(i,x) for(int i=H[x];i;i=E[i])
#define fz(a,b) memset(a,b,sizeof a)
#define JB(a,b)(T[++t]=b,E[t]=H[a],H[a]=t)
#define ll long long
#define N 100001
#define M 101
int C[N],A[N],V[N],n,a,b,x,r;
ll w,m,y;
ll check(int x){
	ll y=x;
	For(i,2,b){
		y*=x;
		if(y>m)return 0;
	}
	return y;
}
void dfs(int x,ll v){
	if(x>n)return;
	dfs(x+1,v);
	For(i,1,V[x]){
		v*=A[x];
		if(v<=r&&y/v<=r)if(y/v==v)w+=1ll*C[v]*(C[v]-1);
		else w+=1ll*C[v]*C[y/v];
		dfs(x+1,v);
	}
}
int main() {
	cin>>a>>b;
	For(i,1,a)scanf("%d",&x),++C[x],r=max(r,x);
	m=r*r;
	For(i,1,m){
		y=check(i);
		if(!y)break;
		int x=i;
		n=0;
		if(x==1)A[++n]=1,V[n]=1;
		for(res j=2;j*j<=x;++j)if(x%j==0){
			A[++n]=j,V[n]=1,x/=j;
			while(x%j==0)++V[n],x/=j;
			V[n]*=b;
		}
		if(x!=1)A[++n]=x,V[n]=b;
		dfs(1,1);
		if(y<=r&&y!=1)w+=1ll*C[1]*C[y];
	}
	cout<<w/2;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
		for(int j=1;j<=K-now;j++)
        {
			nx*=i;
			if(nx>100000)return 0;
		}
	}
    for(int i=2;i<=K;i++)
	{
		nx*=x;
		if(nx>100000)return 0;
	}
	if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    long long ans=0;
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans=(cnt[a[i]]-1+ans);
        else ans=(long long)(cal(a[i])+ans);
    cout<<ans/2;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx;

int cal(int x)
{
    int bef=x;
    long long nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
		for(int j=1;j<=K-now;j++)
        {
			nx*=i;
			if(nx>100000)return 0;
		}
	}
    for(int i=2;i<=K;i++)
	{
		nx*=x;
		if(nx>100000)return 0;
	}
	if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    long long ans=0;
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans=(cnt[a[i]]-1+ans);
        else ans=(long long)(cal(a[i])+ans);
    cout<<ans/2;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
		for(int j=1;j<=K-now;j++)
        {
			nx*=i;
			if(nx>100000)return 0;
		}
	}
    for(int i=2;i<=K;i++)
	{
		nx*=x;
		if(nx>100000)return 0;
	}
	if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    long long ans;
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans+=(cnt[a[i]]-1);
        else ans=(long long)(cal(a[i])+ans);
    printf("%d\n",ans/2);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx,ans;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)for(int j=1;j<=K-now;j++)
            nx*=i;
    }
    for(int i=2;i<=K;i++)nx*=x;
    if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans+=cnt[a[i]]-1;
        else ans+=cal(a[i]);
    printf("%d\n",ans/2);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx,ans;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
			for(int j=1;j<=K-now;j++)
            {
				nx*=i;
				if(nx>100000)return 0;
			}
	}
    for(int i=2;i<=K;i++)
	{
		nx*=x;
		if(nx>100000)return 0;
	}
	if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans+=cnt[a[i]]-1;
        else ans+=cal(a[i]);
    printf("%d\n",ans/2);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx,ans;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
			for(int j=1;j<=K-now;j++)
            {
				nx*=i;
				if(nx>100000)return 0;
			}
	}
    for(int i=2;i<=K;i++)nx*=x;
    if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans+=cnt[a[i]]-1;
        else ans+=cal(a[i]);
    printf("%d\n",ans/2);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#define N 100010
using namespace std;

int n,a[N],x,flag,cnt[N],now,K,nx,ans;

int cal(int x)
{
    int bef=x;
    nx=1;
    for(int i=2;i*i<=x;i++)
    {
        now=0;
        while(x%i==0)
        {
            now++;
            x/=i;
        }
        if(now)
			for(int j=1;j<=K-now;j++)
            {
				nx*=i;
				if(nx>100000)return 0;
			}
	}
    for(int i=2;i<=K;i++)
	{
		nx*=x;
		if(nx>100000)return 0;
	}
	if(nx>100000)return 0;
    if(nx==bef)return cnt[nx]-1;
    return cnt[nx];
}

int main(){
    scanf("%d%d",&n,&K);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&x);
        flag=0;
        nx=1;
        for(int j=2;j*j<=x;j++)
            {
                now=0;
                while(x%j==0)
                    {
                        now++;
                        x/=j;
                    }
                now%=K;
                if(now)
                {
                    flag=1;
                    for(int k=1;k<=now;k++)nx*=j;
                }
            }
        if(x!=1)
        {
            flag=1;
            nx*=x;
        }
        nx*=flag;
        cnt[nx]++;
        a[i]=nx;
    }
    for(int i=1;i<=n;i++)
        if(a[i]==0)ans+=(cnt[a[i]]-1);
        else ans+=cal(a[i]);
    printf("%d\n",ans/2);
    return 0;
}


/**
 *  Author : Coda
 *  Title : D
 *  Date : 2019-10-26
 */
#include <bits/stdc++.h>
using namespace std ;

typedef long long ll ;
typedef unsigned long long ull ;
typedef double DB ;
const long long mod = 1e9+7 ;
const double pi = acos(-1) ;
#define PB push_back
#define MP make_pair
#define lb lower_bound
#define ub upper_bound
#define Fi first
#define Se second
#define pii pair<int,int>
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define debug(x) cout << #x << " = " << x << endl
#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl
#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl
//#pragma comment(linker,"/STACK:10240000,10240000")
//#include <random>
//mt19937 rand_(time(0));
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll qpow(ll a,ll b){ll t=1;while(b){if(b&1)t=t*a;a=a*a;b>>=1;}return t;}
//ll inv(ll x){return qpow(x,mod-2,mod);}
int test = 1 ;

const int maxn = 5 + 3e5 ;
const int maxm = 5 + 1e6 ;
// Write the variables here

ll n,k ;
ll cnt[maxn] ;

ll dv(ll a, ll b){
    if(a%b==0)
        return a/b ;
    return a/b+1 ;
}

int main(){
#ifndef ONLINE_JUDGE
    //freopen("in.txt","r",stdin) ;
#endif
    while(test--){
        // code begins
        scanf("%lld%lld",&n,&k) ;
        ll mx = 0 ;
        for(int i=1 ; i<=n ; i++){
            ll x ;
            scanf("%lld",&x) ;
            cnt[x]++ ;
            mx = max(mx,x) ;
        }
        ll ans = 0 ;
        for(ll i=1 ; i<=mx ; i++){
            if(cnt[i]==0) continue ;
            ll t = i ;
            ll tmp = 1 ;
            for(ll j=2 ; j*j<=t ; j++){
                if(t%j==0){
                    ll c=0 ;
                    while(t%j==0){
                        c++ ;
                        t/=j ;
                    }
                    tmp *= qpow(j,dv(c,k)) ;
                }
            }
            if(t>1) tmp *= t ;
            //puts("") ;
            for(ll j=tmp ; ; j+=tmp){
                bool flag = false ;
                ll x=1,b=k,c=j ;
                while(b){
                    if(c*x>mx*mx) {flag=true;break;}
                    if(b&1) x = x*c ;
                    c = c*c ;
                    b >>= 1 ;
                    if(c>1e5 && b){flag=true;break;}
                    //debug2(x,c) ;
                }
                if(flag==true) break ;
                if(x/i>mx) break ;
                //debug2(i,x) ;

                if(x%i==0){
                    if(x/i==i) ans += cnt[i]*(cnt[i]-1) ;
                    else ans += cnt[i]*cnt[x/i] ;
                }
            }
            //debug(ans) ;
        }
        ans /= 2 ;
        printf("%lld\n",ans) ;

    }
#ifndef ONLINE_JUDGE
    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
#endif
    return 0 ;
}