Bobo has an undirected graph with n vertices which are conveniently labeled with 1,2,…,n. Let V be the set of vertices and E be the set of edges. He would like to count the number of tuples (v_1,v_2,…,v_6) where:
The input contains zero or more test cases, and is terminated by end-of-file. For each test case:
The first line contains an integer n (1≤n≤1000).
The i-th of the following n lines contains a string g_i of length n where g_i,j denotes the existence of edge i,j (g_i,j∈0,1, g_i,i=0, g_i,j=g_j,i).
It is guaranteed that the sum of n does not exceed 1000.
For each test case, output an integer which denotes the number of tuples.