import java.util.*;
public class Main{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] a = new int[n];
int count =0;
for(int i =0;i<n;i++){
a[i] = input.nextInt();
}
for(int i =0;i<n;i++){
for(int j =0;j<n;j++){
if(a[i]-a[j] == 1)
count++;
}
}
System.out.print(count);
}//main
}//Main
14-09-1(相邻数对)
猜你喜欢
转载自blog.csdn.net/qq_51985653/article/details/121395001
今日推荐
周排行