class Program
{
static void Main(string[] args)
{
int[] A = new int[] { 3, 4, 3, 4, 5, 6, 6 };
int strLen = FindS(A,A.Length);
Console.WriteLine(strLen);
Console.ReadKey();
}
public static int FindS(int[] A, int n)
{
for (int i = 0; i < n - 1; i++)
{
for (int j = i + 1; j < n; j++)
{
if (A[i] > A[j])
{
int temp = A[j];
A[j] = A[i];
A[i] = temp;
}
}
}
int result = -1;
for (int i = 0; i < n; i = i + 2) //i=i+2挺好
{
if (A[i] != A[i + 1])
{
result = A[i];
break;
}
}
return result;
}
}