'use strict';
let fn = val => {
  return val % 2 == 0 ? val / 2 : val * 3 + 1;
};
let execute = input => {
  let mochies = input.split('\n').map(str => +str);
  mochies.shift();
  return new Set(mochies).size;
};

function Main(input) {
  console.log(execute(input));
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));