#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <cstdio>
#include <cctype>
#include <queue>
#include <complex>
#include <climits>

typedef long long ll;

using namespace std;

char field[12][12];

void dfs(int x, int y){
	field[x][y] = '0';
	for(int dx=-1; dx<=1; ++dx){
		for(int dy=-1; dy<=1; ++dy){
			if(dx != 0 && dy != 0) continue;
			int nx = x+dx, ny = y+dy;
			if(0 <= nx && nx < 12 && 0 <= ny && ny < 12 && field[nx][ny] == '1'){
				dfs(nx,ny);
			}
		}
	}
}

int main(void){
	while(1){
		if(cin >> field[0][0] == 0) break;
		for(int i=0; i<12; ++i){
			for(int j=0; j<12; ++j){
				if(i==0&&j==0)continue;
				cin >> field[i][j];
			}
		}
			
		int count = 0;

		for(int i=0; i<12; ++i){
			for(int j=0; j<12; ++j){
				if(field[i][j] == '1'){
					dfs(i, j);
					count++;
				}
			}
		}

		cout << count << endl;

	}
	return 0;
}
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <fstream>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
typedef long long ll;

#define INF 1000000000

int main(){
    int m,mi,mx;
    while(cin>>m>>mi>>mx, m){
        vector<int> p(m);
        rep(i,m) cin>>p[i];

        sort(all(p), greater<int>());

        int n, gap=0;

        for(int i=mi-1; i<mx; i++){
            if(p[i]-p[i+1] >= gap){
                n=i+1;
                gap = p[i]-p[i+1];
            }
        }
        cout<<n<<endl;
    }

  return 0;
}