title: find the element that appears once in the array when others appear twice
body: <p>I wrote the code with o(n^2) complexity.I could not find the error.My idea was to first sort the array and then starting from the first element if the second next is equal increment i by 2 and when the if condition is not fulfilled the element is found Can someone please help me this. 
  Thanks in advance</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int main()
  {
  int arr[100];
  int n,i,j,temp;
  cin&gt;&gt;n;
  for(i=0;i&lt;n;i++)
  {
      cin&gt;&gt;arr[i];
  }
  for(i=0;i&lt;n;i++)
  {
      for(j=0;j&lt;n;j++)
      {
          if(arr[i]&gt;arr[j])
          {
              temp = arr[j];
              arr[j] = arr[i];
              arr[i] = temp;
          }
      }
  }
  i=0;
  for(j=i+1;j&lt;n;j++)
  {
      if(arr[i] == arr[j])
      {
          i=i+2;
      }
  }
  cout&lt;&lt;arr[i];
  return 0;
  }
  </code></pre>