Cosmic ray electron and positron spectra measured with PAMELA