import java.util.Calendar; import java.text.SimpleDateFormat; class Wandbox { public static void main(String[] args) { Calendar calendar = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); calendar.set(2014, 11, 31, 1, 1, 1); int cnt = 0; while(calendar.get(calendar.YEAR) <= 2015) { calendar.add(Calendar.DATE, 1); if(calendar.get(calendar.YEAR) != 2015) { break; } String time =sdf.format(calendar.getTime()); int mon = Integer.parseInt(time.substring(5,7)); int day10 = Integer.parseInt(time.substring(8,9)); int day1 = Integer.parseInt(time.substring(9)); if(mon == day1 + day10) { cnt++; } } System.out.println(cnt); } }