If you're flying from a Canadian airport to the US (from Ottawa or Toronto at least) you actually clear US customs while still in Canada. This is actually very convenient as before they started this clearing customs in the US would involve a long line if many fights were arriving at the same time.