'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', function(inputStdin) {
inputString += inputStdin;
});
process.stdin.on('end', function() {
inputString = inputString.split('\n');
main();
});
function readLine() {
return inputString[currentLine++];
}
/*
* Complete the 'findMinimumDays' function below.
*
* The function is expected to return an INTEGER.
* The function accepts FLOAT_ARRAY durations as parameter.
*/
function findMinimumDays(durations) {
// Write your code here
durations=durations.sort((a,b)=>a-b);
let left=0;
let right=durations.length-1;
let days=0;
while(left<=right){
if(left==right){
days++;
break;
}
if(durations[left]+durations[right]<=3.0){
left++;
right--;
days++;
}
else{
right--;
days++
}
}
return days;
}
function main() {
const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
const durationsCount = parseInt(readLine().trim(), 10);
let durations = [];
for (let i = 0; i < durationsCount; i++) {
const durationsItem = parseFloat(readLine().trim());
durations.push(durationsItem);
}
const result = findMinimumDays(durations);
ws.write(result + '\n');
ws.end();
}