/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <map>
#include <cmath>


#include <vector>
#include <cstddef>


#include <iterator>


#include <string>
#include <stdexcept>

#ifndef SPCPPL_ASSERT
	#ifdef SPCPPL_DEBUG
		#define SPCPPL_ASSERT(condition) \
		if(!(condition)) { \
			throw std::runtime_error(std::string() + #condition + " in line " + std::to_string(__LINE__) + " in " + __PRETTY_FUNCTION__); \
		}
	#else
		#define SPCPPL_ASSERT(condition)
	#endif
#endif


/**
* Support decrementing and multi-passing, but not declared bidirectional(or even forward) because
* it's reference type is not a reference.
*
* It doesn't return reference because
* 1. Anyway it'll not satisfy requirement [forward.iterators]/6
*   If a and b are both dereferenceable, then a == b if and only if *a and
*   b are bound to the same object.
* 2. It'll not work with reverse_iterator that returns operator * of temporary which is temporary for this iterator
*
* Note, reverse_iterator is not guaranteed to work  now too since it works only with bidirectional iterators,
* but it's seems to work at least on my implementation.
*
* It's not really useful anywhere except iterating anyway.
*/
template <typename T>
class IntegerIterator: public std::iterator<std::input_iterator_tag, T, std::ptrdiff_t, T*, T> {
public:
	explicit IntegerIterator(T value): value(value) {

	}

	IntegerIterator& operator++() {
		++value;
		return *this;
	}

	IntegerIterator operator++(int) {
		IntegerIterator copy = *this;
		++value;
		return copy;
	}

	IntegerIterator& operator--() {
		--value;
		return *this;
	}

	IntegerIterator operator--(int) {
		IntegerIterator copy = *this;
		--value;
		return copy;
	}

	T operator*() const {
		return value;
	}

	bool operator==(IntegerIterator rhs) {
		return value == rhs.value;
	}

	bool operator!=(IntegerIterator rhs) {
		return !(*this == rhs);
	}

private:
	T value;
};

template <typename T>
class IntegerRange {
public:
	IntegerRange(T begin, T end): begin_(begin), end_(end) {
		SPCPPL_ASSERT(begin <= end);
	}

	IntegerIterator<T> begin() const {
		return IntegerIterator<T>(begin_);
	}

	IntegerIterator<T> end() const {
		return IntegerIterator<T>(end_);
	}

private:
	T begin_;
	T end_;
};

template <typename T>
class ReversedIntegerRange {
	typedef std::reverse_iterator<IntegerIterator<T>> IteratorType;
public:
	ReversedIntegerRange(T begin, T end): begin_(begin), end_(end) {
		SPCPPL_ASSERT(begin >= end);
	}

	IteratorType begin() const {
		return IteratorType(IntegerIterator<T>(begin_));
	}

	IteratorType end() const {
		return IteratorType(IntegerIterator<T>(end_));
	}

private:
	T begin_;
	T end_;
};

template <typename T>
IntegerRange<T> range(T to) {
	return IntegerRange<T>(0, to);
}

template <typename T>
IntegerRange<T> range(T from, T to) {
	return IntegerRange<T>(from, to);
}

template <typename T>
IntegerRange<T> inclusiveRange(T to) {
	return IntegerRange<T>(0, to + 1);
}

template <typename T>
IntegerRange<T> inclusiveRange(T from, T to) {
	return IntegerRange<T>(from, to + 1);
}

template <typename T>
ReversedIntegerRange<T> downrange(T from) {
	return ReversedIntegerRange<T>(from, 0);
}

template <typename T>
ReversedIntegerRange<T> downrange(T from, T to) {
	return ReversedIntegerRange<T>(from, to);
}

template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from) {
	return ReversedIntegerRange<T>(from + 1, 0);
}

template <typename T>
ReversedIntegerRange<T> inclusiveDownrange(T from, T to) {
	return ReversedIntegerRange<T>(from + 1, to);
}


bool isPrime(int n) {
	for (int i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			return false;
		}
	}
	return n >= 2;
}

bool isPrime(int64_t n) {
	for (int i = 2; i * i <= n; ++i) {
		if (n % i == 0) {
			return false;
		}
	}
	return n >= 2;
}

struct Bool {
	/* implicit */ Bool(bool value): value(value) {

	}

	operator bool() const {
		return value;
	}

private:
	bool value;
};

std::vector<Bool> primeMap(std::size_t maxN) {
	std::vector<Bool> prime(maxN + 1, true);

	prime[0] = false;
	prime[1] = false;

	for (std::size_t i = 2; i * i <= maxN; ++i) {
		if (prime[i]) {
			if (i * 1ULL * i <= maxN) {
				for (std::size_t j = i * i; j <= maxN; j += i) {
					prime[j] = false;
				}
			}
		}
	}
	return prime;
}

std::vector<int> allPrimes(int maxN) {
	std::vector<int> result;
	result.reserve(maxN);
	std::vector<Bool> map = primeMap(maxN);
	for (int i: range(maxN + 1)) {
		if (map[i]) {
			result.push_back(i);
		}
	}
	return result;
}

int nextPrime(int n) {
	while (!isPrime(n)) {
		++n;
	}
	return n;
}


using namespace std;

class D {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n;
		in >> n;

		auto primes = allPrimes(100000);
		vector<int64_t> v(n);
		for (int i: range(n)) {
			in >> v[i];
		}


		int64_t ans = 0;
		for (auto& x: v) {
			for(int p: primes) {
				long long int cube = 1LL * p * p * p;
				if (cube > x) {
					break;
				}
				while (x % cube == 0) {
					x /= cube;
				}
			}
		}

		map<int64_t, int> z;
		for (auto x: v) {
			++z[x];
		}

		int64_t INF = 10000000000 + 1;

		for (auto pr: z) {
			if (pr.first == 1) {
				ans += 1;
				continue;
			}
			if(pr.second == 0) {
				continue;
			}
			int64_t res;

			int64_t other = 1;
			long long int num = pr.first;

			for(int p: primes) {
				long long int cube = 1LL * p * p * p;
				if (cube > num) {
					break;
				}
				if (num % (p * p) == 0) {
					other *= p;
					if (other > INF) {
						other = INF;
					}
					num /= p;
					num /= p;
				}
				else if (num % p == 0) {
					other *= p;
					if (other > INF) {
						other = INF;
					}
					other *= p;
					if (other > INF) {
						other = INF;
					}
					num /= p;
				}
			}
			if (num != 1) {
				int64_t s = sq(num);
				if (s != -1) {
					other *= s;
					if (other > INF) {
						other = INF;
					}
				} else {
					other *= num;
					if (other > INF) {
						other = INF;
					}
					other *= num;
					if (other > INF) {
						other = INF;
					}
				}
			}


			if (z.count(other)) {
				ans += max(pr.second, z[other]);
				z[other] = 0;
			} else {
				ans += pr.second;
			}
		}

		out << ans << "\n";
	}

	int64_t sq(int64_t n) {
		int64_t res = (int64_t) sqrt(n);
		for (int64_t i = res - 1; i < res + 2; ++i) {
			if (i * i == n) {
				return i;
			}
		}
		return -1;
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	D solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(0);
	out << std::fixed;
	out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 7296