#include #include #include #include #include #include #include using namespace std; int n; string s, t; vector vec; int zeroS[1005], zeroT[1005]; void ope(int x) { vec.push_back(x%(2*n)); vec.push_back((x+1)%(2*n)); } int main() { cin >> n >> s >> t; assert(n >= 1 && n <= 500); assert(s.size() == 2*n && t.size() == 2*n); for(int i = 0; i < s.size(); i++) assert(s[i] == '0' || s[i] == '1'); for(int i = 0; i < t.size(); i++) assert(t[i] == '0' || t[i] == '1'); for(int i = 0; i < n; i++) if(s[i] == '0' && s[i+n] == '0') zeroS[i] = 1; for(int i = 0; i < n; i++) if(t[i] == '0' && t[i+n] == '0') zeroT[i] = 1; for(int i = 0; i < n; i++){ if(zeroS[i] != zeroT[i]){ cout << -1 << endl; return 0; } } for(int i = 0; i < n; i++){ if(zeroS[i]) continue; if(s[i] == '0' && s[i+n] == '1'){ if(t[i] == '1' && t[i+n] == '1') ope(i+n); if(t[i] == '1' && t[i+n] == '0') ope(i); } else if(s[i] == '1' && s[i+n] == '0'){ if(t[i] == '1' && t[i+n] == '1') ope(i); if(t[i] == '0' && t[i+n] == '1') ope(i+n); } else if(s[i] == '1' && s[i+n] == '1'){ if(t[i] == '0' && t[i+n] == '1') ope(i); if(t[i] == '1' && t[i+n] == '0') ope(i+n); } } cout << vec.size() << endl; for(int i = 0; i < vec.size(); i++) cout << vec[i] << endl; return 0; }