#include <iostream>
using namespace std;

int main() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (a == 1)cout << "1" << endl;
    else if (b == 1)cout << "2" << endl;
    else if (c == 1)cout << "3" << endl;
    else if (d == 1)cout << "4" << endl;
    else if (e == 1)cout << "5" << endl;
    return 0;

}
// 64 位输出请用 printf("%lld")