import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { int n = readln.chomp.to!int; int level, amari; iota(n).map!(i => readln.split.to!(int[])).array.joiner.array.sort().group.each!(x => (level += x[1]/2, amari += x[1]%2)); level += amari/4; writeln(level); }