#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int x;
    int count = 0;

    while (cin >> x) {
        if (x == 999) {
            break;
        }
        count++;
    }

    cout << count << "\n";

    return 0;
}