#include <iostream>
using namespace std;

template<class T>
struct my_rank{
	static constexpr unsigned value = 0;
};
template<class T, unsigned I>
struct my_rank<T[I]>{
	static constexpr unsigned value = my_rank<T>::value + 1;	
};

int main() {
	int a3[3][3][3];
	int a2[3][3];
	int a7[3][3][3][3][3][3][3];
	std::cout << my_rank<decltype(a3)>::value << std::endl;//3
	std::cout << my_rank<decltype(a2)>::value << std::endl;//2
	std::cout << my_rank<decltype(a7)>::value << std::endl;//7
	std::cout << my_rank<decltype(a3[0][0][0])>::value << std::endl;//0
	return 0;
}