I have the following list in Excel:

```
+-------+----------+
|  am   | ipiresia |
+-------+----------+
| 50470 |       29 |
| 50470 |       43 |
| 50433 |       29 |
|  6417 |       51 |
|  6417 |       52 |
|  6417 |       53 |
|  4960 |       25 |
|  4960 |       26 |
|  5567 |       89 |
|  6716 |       88 |
+-------+----------+

```

I want to add a column, let's say 'num' and count the occurrences of column 'am' in a row adding one when a new occurrence happens as follows:

```
+-------+----------+-----+
|  am   | ipiresia | num |
+-------+----------+-----+
| 50470 |       29 |   1 |
| 50470 |       43 |   2 |
| 50433 |       29 |   1 |
|  6417 |       51 |   1 |
|  6417 |       52 |   2 |
|  6417 |       53 |   3 |
|  4960 |       25 |   1 |
|  4960 |       26 |   2 |
|  5567 |       89 |   1 |
|  6716 |       88 |   1 |
+-------+----------+-----+

```

Is it possible to get this automatically with a formula in Excel?