int main(int , char*[])
{
        int num;
        float ave, min, sum = 0.0;
        std::vector<int> frames;
        std::cin >> num;
        frames.resize(num);
        for (int i = 0; i < num; i++) {
                int tmp;
                std::cin >> tmp;
                frames[i] = tmp;
                sum += frames[i];
        }
        ave = sum / num;
        min = FLT_MAX;
        int ret = 0;
        for (int i = 0; i < num; i++) {
                float diff = frames[i] - ave;
                if (diff < 0)
                        diff = 0 - diff;
                if (min > diff) {
                        min = diff;
                        ret = i;
                }
        }
        std::cout << ret << std::endl;

        return ret;
}