4. Before reciting the blessing, one should know exactly what the blessing
is being recited over, that is, one should know the day of the Omer that
one will count. However, if one recited the blessing with the intent of
counting the number that one will hear [immediately after] from a
colleague, one fulfills his obligation.
Similarly, if one recited the blessing with the intention of counting it as
the fourth day, and, after reciting the blessing, realized that he should
be counting it as the fifth day, he should count it as the fifth day,
without repeating the blessing. Furthermore, even if he actually counted
in error, for example, he counted it as day five rather than day six, - if
he realized his error immediately (1), he may count the correct day without
reciting a second blessing. If, however, time passed [before he realized
the error], he must recite a second blessing [and then say the correct number].
(1) "Immediately" is defined as the time it takes to say "Shalom Alecha
Rebbe" (Peace be upon you, Rabbi).