#include using namespace std; #define MAX 105 int a[MAX][MAX], i, j, k, n, m; int main() { cin>>k>>n>>m; if(n==k || m==k) { if(n==m) { if(k==1) { cout<<"0\n"; return 0; } if(k==2) { cout<<"-1\n"; return 0; } if(k==3) { cout<<"-1\n"; return 0; } } for(i=1;i