eolymp
bolt
Try our new interface for solving problems
Problems

Work for Robots

Work for Robots

There are \textbf{n} robots on planet PTZZZ. Some of the robots are friends, and some of them are not. Once a day some of the robots go to work and all the other robots go to a theme park and have fun. At least one robot should go to work. An administrator-robot decides who should go to work and who should have fun. The work is so important for robots that the first day when the administrator-robot made his decision was named the First day of the World. If it turns out that the group of robots that goes to work is the same as the group in any day before, the administrator-robot will rust of sadness. Moreover, the law doesn't allow the administrator-robot to form a working group in such a way that there will be a pair of robots in this group that are not friends. The administrator-robot doesn't want to rust, so since the first day he tries to form a different working group. However, the administrator-robot will rust sooner or later. Your task is to calculate the day number when this will happen. \InputFile The first line contains an integer \textbf{n}, the number of robots on PTZZZ (\textbf{1} ≤ \textbf{n} ≤ \textbf{50}). Each of the next \textbf{n} lines contains \textbf{n} digits \textbf{0} or \textbf{1}. \textbf{j}-th digit in \textbf{i}-th line is \textbf{1} if \textbf{i}-th and \textbf{j}-th robots are friends, and \textbf{0} otherwise. It is guaranteed that \textbf{i}-th digit in \textbf{i}-th line is equal to zero, and \textbf{j}-th digit in \textbf{i}-th line is equal to \textbf{_i}-th digit in \textbf{j}-th line. \OutputFile Output the day number the administrator-robot will rust in.
Time limit 2 seconds
Memory limit 64 MiB
Input example #1
6
011100
101100
110100
111000
000001
000010
Output example #1
19
Author M.Kolodyazhniy, A.Samsonov
Source Ural SU Contest. Petrozavodsk Winter Session, February 2009