title: Difference between increment and addition in this question?
body: <pre><code>public class Solution {
  
      public static void main(String[] args) {
          Scanner in = new Scanner(System.in);
          int n = in.nextInt();
          int c[] = new int[n];
          for(int c_i=0; c_i &lt; n; c_i++){
              c[c_i] = in.nextInt();
          }
          Arrays.sort(c);
          int t=0;
          for (int i=0;i&lt;n-1;i++){
              if(c[i]==c[i+1]){
                  t++;
                  i++;
              }
          }
          System.out.println(t);
      }
  }
  </code></pre>
  
  <p>When I am removing i++ from if condition and making i=i+2 in for loop, the output is changing for certain test cases. Can someone explain me the reason as in both conditions i is incrementing by 2.</p>