Language: C++

using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;


class Program
{
    public static double Jacc(HashSet<int> A,HashSet<int> B) {
        HashSet<int> tmp = new HashSet<int>();
        foreach (int e in A) tmp.Add(e);
        foreach (int e in B) tmp.Add(e);

        double OR_len = tmp.Count();
        double AND_len = A.Count() + B.Count() - OR_len;

        return AND_len / OR_len;
    }

    static void Main(string[] Args) {

        int N = Int32.Parse(ReadLine());
        var a = new List<string>(ReadLine().Split(' ')).Select(int.Parse).GroupBy(x => x).ToList();

        if(a.Count() == 2) {
            if((a[0].Key ^ a[1].Key) == a[0].Key) {
                if(Math.Abs((getmin(a[0].Count(),a[1].Count()) * 2) - (getmax(a[0].Count(),a[1].Count()))) <= 1) {
                    WriteLine("Yes");
                    goto ProgramEndPointLabel;
                } else {
                    WriteLine("No");
                    goto ProgramEndPointLabel;
                }
            } else {
                WriteLine("No");
                goto ProgramEndPointLabel;
            }
        } else if(a.Count() == 3) {
            if((a[0].Key ^ a[1].Key) == a[2].Key) {
                if(getmax(getmax(a[0].Count(),a[1].Count()),a[2].Count()) - getmin(getmin(a[0].Count(),a[1].Count()),a[2].Count()) <= 1) {
                    WriteLine("Yes");
                    goto ProgramEndPointLabel;
                } else {
                    WriteLine("No");
                    goto ProgramEndPointLabel;
                }
            } else {
                WriteLine("No");
                goto ProgramEndPointLabel;
            }
        } else {
            WriteLine("No");
            goto ProgramEndPointLabel;
        }

        goto ProgramEndPointLabel;
        ProgramEndPointLabel:;
        ReadLine();
    }


    static int getmin(int x,int y) {
        return (x < y) ? y : x;
    }
    static int getmax(int x,int y) {
        return (x < y) ? x : y;
    }

    class MyList<T> : List<T>
    {
        public override bool Equals(object obj) {
            List<T> obj_ = (List<T>)obj;
            if (this.Count != obj_.Count) return false;
            for (int i = 0; i < this.Count(); i++) {
                if (!this[i].Equals(obj_[i])) {
                    //WriteLine(this[i].Equals(obj_[i]));
                    //WriteLine(string.Format("this[{0}] = {1},obj_[{0}] = {2}", i, this[i], obj_[i]));
                    return false;
                }
            }
            return true;
        }
        public override int GetHashCode() {
            return base.GetHashCode();
        }
        //public static implicit operator MyList<T> (List<T> obj) {
        public static MyList<T> conv(List<T> obj) {
            MyList<T> res = new MyList<T>();
            foreach (T e in obj) res.Add(e);
            return res;
        }
        public MyList<T> Copy() {
            MyList<T> res = new MyList<T>();
            foreach(T e in this)
                res.Add(e);
            return res;
        }
    }

    static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
        if(Count == 0) {
            MyList<MyList<int>> res = new MyList<MyList<int>>();
            MyList<int> res_ = new MyList<int>();
            res_.Add(-1);
            res.Add(res_);
            return res;
        }
        MyList<MyList<int>> res_indexes = new MyList<MyList<int>>();
        for(int i = 0;i < Dict.Count(); i++) {
            MyList<Tuple<int,char,int>> clone = Dict.Copy();
            clone.RemoveAt(i);
            MyList<MyList<int>> res = GetIndex(clone, Count - 1);
            MyList<int> temporary = new MyList<int>();
            foreach(MyList<int> ele in res) {
                temporary = new MyList<int>();
                temporary.Add(Dict[i].Item1);
                foreach(int ele_s_ele in ele) {
                    temporary.Add(ele_s_ele);
                }
                temporary.Sort();
                if(!res_indexes.Contains(temporary))
                    res_indexes.Add(temporary);
            }
        }
        
        //res_indexes = MyList<MyList<int>>.conv(res_indexes.Distinct().ToList());

        for (int i = 0; i < res_indexes.Count; i++)
            res_indexes[i].Remove(-1);
                
        return res_indexes;
    }

    static int div2(Dictionary<char,int> Dict,char without,int count) {
        if (count == 0) return 1;
        Dictionary<char, int> Dict_Copyed;
        Clone(Dict,out Dict_Copyed);
        Dict_Copyed.Remove(without);
        //foreach(var e in Dict_Copyed) 
        //    WriteLine(e.Key + ":" + e.Value + " ");
        //line();
        int result = 0;
        foreach(var e in Dict_Copyed) {
            result += div2(Dict_Copyed, e.Key, count - 1) * e.Value;
        }
        return result;
    }

    static void line() { WriteLine(); }

    static int kaizyo(int x) {
        int res = 1;
        for (int i = 1; i <= x; i++) res *= i;
        return res;
    }

    static void Clone(Dictionary<char,int> ori,out Dictionary<char,int> tar) {
        tar = new Dictionary<char, int>();
        foreach (KeyValuePair<char,int> e in ori)
            tar.Add(e.Key,e.Value);
    }

    static int div(Dictionary<char, int> _Dict,char without,int count) {
        if (count == 0) return 1;
        Dictionary<char, int> Dict = new Dictionary<char, int>();
        foreach (KeyValuePair<char,int> c in _Dict)
            Dict.Add(c.Key,c.Value);
        Dict.Remove(without);
        int Result = 0;
        foreach (KeyValuePair<char, int> c in Dict) {
            Result += div(Dict, c.Key, count - 1) * c.Value;
        }
        return Result;
    }

    static int C(int x,int y) {
        int Result = 1;
        for(int count = 0;count < y; count++)
            Result *= (x - count);
        for (int count = 0;count < y; count++)
            Result /= (y - count);
        return Result;
    }
}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'static'
    3 | using static System.Console;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Linq;
      |       ^~~~~~
a.cc:9:11: error: expected ':' before 'static'
    9 |     public static double Jacc(HashSet<int> A,HashSet<int> B) {
      |           ^~~~~~~
      |           :
a.cc:9:31: error: 'HashSet' has not been declared
    9 |     public static double Jacc(HashSet<int> A,HashSet<int> B) {
      |                               ^~~~~~~
a.cc:9:38: error: expected ',' or '...' before '<' token
    9 |     public static double Jacc(HashSet<int> A,HashSet<int> B) {
      |                                      ^
a.cc:20:22: error: 'string' has not been declared
   20 |     static void Main(string[] Args) {
      |                      ^~~~~~
a.cc:20:31: error: expected ',' or '...' before 'Args'
   20 |     static void Main(string[] Args) {
      |                               ^~~~
a.cc:69:11: error: 'MyList' is not a class template
   69 |     class MyList<T> : List<T>
      |           ^~~~~~
a.cc:69:18: error: 'T' was not declared in this scope
   69 |     class MyList<T> : List<T>
      |                  ^
a.cc:69:27: error: expected template-name before '<' token
   69 |     class MyList<T> : List<T>
      |                           ^
a.cc:69:27: error: expected '{' before '<' token
a.cc:69:27: error: expected unqualified-id before '<' token
a.cc:100:12: error: 'Program::MyList' is not a template
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |            ^~~~~~
a.cc:100:19: error: 'Program::MyList' is not a template
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                   ^~~~~~
a.cc:100:41: error: 'Program::MyList' is not a template
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                                         ^~~~~~
a.cc:100:48: error: 'Tuple' was not declared in this scope
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                                                ^~~~~
a.cc:100:54: error: expected primary-expression before 'int'
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                                                      ^~~
a.cc:100:54: error: expected '>' before 'int'
a.cc:134:21: error: 'Dictionary' has not been declared
  134 |     static int div2(Dictionary<char,int> Dict,char without,int count) {
      |                     ^~~~~~~~~~
a.cc:134:31: error: expected ',' or '...' before '<' token
  134 |     static int div2(Dictionary<char,int> Dict,char without,int count) {
      |                               ^
a.cc:157:23: error: 'Dictionary' has not been declared
  157 |     static void Clone(Dictionary<char,int> ori,out Dictionary<char,int> tar) {
      |                       ^~~~~~~~~~
a.cc:157:33: error: expected ',' or '...' before '<' token
  157 |     static void Clone(Dictionary<char,int> ori,out Dictionary<char,int> tar) {
      |                                 ^
a.cc:163:20: error: 'Dictionary' has not been declared
  163 |     static int div(Dictionary<char, int> _Dict,char without,int count) {
      |                    ^~~~~~~~~~
a.cc:163:30: error: expected ',' or '...' before '<' token
  163 |     static int div(Dictionary<char, int> _Dict,char without,int count) {
      |                              ^
a.cc:184:2: error: expected ';' after class definition
  184 | }
      |  ^
      |  ;
a.cc: In static member function 'static double Program::Jacc(int)':
a.cc:10:9: error: 'HashSet' was not declared in this scope
   10 |         HashSet<int> tmp = new HashSet<int>();
      |         ^~~~~~~
a.cc:10:17: error: expected primary-expression before 'int'
   10 |         HashSet<int> tmp = new HashSet<int>();
      |                 ^~~
a.cc:11:18: error: expected primary-expression before 'int'
   11 |         foreach (int e in A) tmp.Add(e);
      |                  ^~~
a.cc:11:9: error: 'foreach' was not declared in this scope
   11 |         foreach (int e in A) tmp.Add(e);
      |         ^~~~~~~
a.cc:12:18: error: expected primary-expression before 'int'
   12 |         foreach (int e in B) tmp.Add(e);
      |                  ^~~
a.cc:14:25: error: 'tmp' was not declared in this scope
   14 |         double OR_len = tmp.Count();
      |                         ^~~
a.cc:15:26: error: 'A' was not declared in this scope
   15 |         double AND_len = A.Count() + B.Count() - OR_len;
      |                          ^
a.cc:15:38: error: 'B' was not declared in this scope
   15 |         double AND_len = A.Count() + B.Count() - OR_len;
      |                                      ^
a.cc: In static member function 'static void Program::Main(int*)':
a.cc:22:17: error: 'Int32' was not declared in this scope
   22 |         int N = Int32.Parse(ReadLine());
      |                 ^~~~~
a.cc:22:29: error: 'ReadLine' was not declared in this scope
   22 |         int N = Int32.Parse(ReadLine());
      |                             ^~~~~~~~
a.cc:23:9: error: 'var' was not declared in this scope
   23 |         var a = new List<string>(ReadLine().Split(' ')).Select(int.Parse).GroupBy(x => x).ToList();
      |         ^~~
a.cc:25:12: error: 'a' was not declared in this scope
   25 |         if(a.Count() == 2) {
      |            ^
a.cc:27:20: error: 'Math' was not declared in this scope
   27 |                 if(Math.Abs((getmin(a[0].Count(),a[1].Count()) * 2) - (getmax(a[0].Count(),a[1].Count()))) <= 1) {
      |                    ^~~~
a.cc:28:21: error: 'WriteLine' was not declared in this scope
   28 |                     WriteLine("Yes");
      |                     ^~~~~~~~~
a.cc:31:21: error: 'WriteLine' was not declared in this scope
   31 |                     WriteLine("No");
      |                     ^~~~~~~~~
a.cc:35:17: error: 'WriteLine' was not declared in this scope
   35 |                 WriteLine("No");
      |                 ^~~~~~~~~
a.cc:41:21: error: 'WriteLine' was not declared in this scope
   41 |                     WriteLine("Yes");
      |                     ^~~~~~~~~
a.cc:44:21: error: 'WriteLine' was not declared in this scope
   44 |                     WriteLine("No");
      |                     ^~~~~~~~~
a.cc:48:17: error: 'WriteLine' was not declared in this scope
   48 |                 WriteLine("No");
      |                 ^~~~~~~~~
a.cc:52:13: error: 'WriteLine' was not declared in this scope
   52 |             WriteLine("No");
      |             ^~~~~~~~~
a.cc: At global scope:
a.cc:100:69: error: 'Dict' has incomplete type
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
a.cc:69:11: note: forward declaration of 'class Program::MyList'
   69 |     class MyList<T> : List<T>
      |           ^~~~~~
a.cc:100:85: error: return type 'class Program::MyList' is incomplete
  100 |     static MyList<MyList<int>> GetIndex(MyList<Tuple<int,char,int>> Dict,int Count) {
      |                                                                                     ^
a.cc: In static member function 'static void Program::GetIndex(MyList, int)':
a.cc:102:13: error: 'Program::MyList' is not a template
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |             ^~~~~~
a.cc:102:20: error: 'Program::MyList' is not a template
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |                    ^~~~~~
a.cc:102:33: error: variable 'Program::MyList res' has initializer but incomplete type
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |                                 ^~~
a.cc:102:43: error: 'Program::MyList' is not a template
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |                                           ^~~~~~
a.cc:102:50: error: 'Program::MyList' is not a template
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |                                                  ^~~~~~
a.cc:102:63: error: invalid use of incomplete type 'class Program::MyList'
  102 |             MyList<MyList<int>> res = new MyList<MyList<int>>();
      |                                                               ^
a.cc:69:11: note: forward declaration of 'class Program::MyList'
   69 |     class MyList<T> : List<T>
      |           ^~~~~~
a.cc:103:13: error: 'Program::MyList' is not a template
  103 |             MyList<int> res_ = new MyList<int>();
      |             ^~~~~~
a.cc:103:25: error: variable 'Program::MyList res_' has initializer but incomplete type
  103 |             MyList<int> res_ = new MyList<int>();
      |                         ^~~~
a.cc:103:36: error: 'Program::MyList' is not a template
  103 |             MyList<int> res_ = new MyList<int>();
      |                                    ^~~~~~
a.cc:103:48: error: invalid use of incomplete type 'class Program::MyList'
  103 |             MyList<int> res_ = new MyList<int>();
      |                                                ^
a.cc:69:11: note: forward declaration of 'class Program::MyList'
   69 |     class MyList<T> : List<T>
      |           ^~~~~~
a.cc:108:9: error: 'Program::MyList' is not a template
  108 |         MyList<MyList<int>> res_indexes = new MyList<MyList<int>>();
      |         ^~~~~~
a.cc:108:16: error: 'Program::MyList' is not a template
  108 |         MyList<MyList<int>> res_indexes = new MyList<MyList<int>>();
      |                ^~~~~~
a.cc:108:29: error: variable 'Program::MyList res_indexes' has initializer but incomplete type
  108 |         MyList<MyList<int>> res_indexes = new MyList<MyL