/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public int func(int a[] , int b[]){
		int n = a.length;
		int m = b.length;
		
		int len = -1;
		int maxi = Integer.MIN_VALUE;
		for(int i=0;i<n;i++){
			int z1 = 0;
		    int z2 = 0;
			for(int j=i;j<n;j++){
				z1 = z1 ^ a[j];
				z2 = z2 ^ b[j];
				if(z1 == z2){
					len = j-i+1;
					maxi = Math.max(maxi,len);
				}
			}
		}
		return maxi;
	}
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Ideone obj = new Ideone();

        int a[] = {1, 2, 3, 5};
        int b[] = {1, 3, 2, 4};

        int ans = obj.func(a, b);

        System.out.println(ans);
	}
}