import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String[] s = sc.nextLine().split(" "); int limit = Integer.valueOf(sc.nextLine()); int[] people = new int[s.length]; for(int i = 0; i < s.length; ++i) people[i] = Integer.valueOf(s[i]); Arrays.sort(people);//按体重排序 int j = 0, k = s.length - 1;//头指针,尾指针 int r = 0;//统计船只数量 while(j < k){ if(people[j] + people[k] <= limit){//最小和最大配对 r++; j++; k--; }else{//超载,则最大单坐一只船 r++; k--; } } if(j == k) r++;//如果中间还剩一个人没有配对,就单独给他一个船 System.out.println(r); } }