#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <string>
#include <tuple>
#include <type_traits>
#include <vector>

// lib/quo.hpp
#ifndef QUO_H
#define QUO_H

/*
a == tools:quo(a, b) * b + tools::mod(a, b)
0 <= tools::mod(a, b) < std::abs(b)
*/

namespace tools {
  template <typename T>
  constexpr T quo(const T lhs, const T rhs) {
    return lhs > 0 ? lhs / rhs : rhs > 0 ? -((-lhs - 1 + rhs) / rhs) : (-lhs - 1 + -rhs) / -rhs;
  }
}

#endif

// lib/less.hpp
#ifndef LESS_HPP
#define LESS_HPP


/*
usage:

std::sort(a.begin(), a.end(), tools::less<int, int>([](int a_i) { return std::abs(x); }));
*/

namespace tools {
  template <class T, class R>
  ::std::function<bool(T, T)> less(const ::std::function<R(T)>& selector) {
    return [selector](const T& x, const T& y) {
      return selector(x) < selector(y);
    };
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/extgcd.hpp
#ifndef EXTGCD_HPP
#define EXTGCD_HPP


/*
usage:

std::tuple<int, int, int> result = tools::extgcd(4, 5);
int gcd = std::get<0>(result);
int x0 = std::get<1>(result);
int y0 = std::get<2>(result);
*/

namespace tools {
  template <typename T>
  std::tuple<T, T, T> extgcd(T prev_r, T r) {
    T prev_s = 1;
    T prev_t = 0;
    T s = 0;
    T t = 1;
    while (r != 0) {
      const T q = quo(prev_r, r);
      const T next_r = prev_r - q * r;
      prev_r = r;
      r = next_r;
      const T next_s = prev_s - q * s;
      prev_s = s;
      s = next_s;
      const T next_t = prev_t - q * t;
      prev_t = t;
      t = next_t;
    }
    return std::make_tuple(std::abs(prev_r), prev_s, prev_t);
  }
}

#endif

// lib/fraction.hpp
#ifndef FRACTION_HPP
#define FRACTION_HPP


/*
usage:

tools::fraction(5, 2) // => (5/2)
*/

namespace tools {
  class fraction {
  private:
    ::std::intmax_t m_numerator;
    ::std::intmax_t m_denominator;

    void reduct() noexcept {
      if (this->m_denominator < 0) {
        this->m_numerator *= -1;
        this->m_denominator *= -1;
      }
      if (this->m_numerator == 0) {
        this->m_denominator = 1;
      } else {
        const ::std::intmax_t gcd = ::std::get<0>(::tools::extgcd(this->m_numerator, this->m_denominator));
        this->m_numerator /= gcd;
        this->m_denominator /= gcd;
      }
    }

    fraction(const ::std::intmax_t numerator, const ::std::intmax_t denominator, bool) noexcept :
      m_numerator(numerator),
      m_denominator(denominator) {
      this->reduct();
    }

  public:
    fraction() noexcept :
      fraction(0, 1, true) {
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    fraction(const T n) noexcept :
      fraction(n, 1, true) {
    }
    template <typename T1, typename T2, typename ::std::enable_if<::std::is_integral<T1>::value && ::std::is_integral<T2>::value, ::std::nullptr_t>::type = nullptr>
    fraction(const T1 numerator, const T2 denominator) :
      m_numerator(numerator),
      m_denominator(denominator) {
      if (this->m_denominator == 0) throw ::std::domain_error("Denominator cannot be zero.");
      this->reduct();
    }

    ::std::intmax_t numerator() const noexcept {
      return this->m_numerator;
    }

    ::std::intmax_t denominator() const noexcept {
      return this->m_denominator;
    }

    explicit operator double() const noexcept {
      return static_cast<double>(this->m_numerator) / this->m_denominator;
    }

    ::tools::fraction operator+() const noexcept {
      return *this;
    }

    ::tools::fraction operator-() const noexcept {
      return ::tools::fraction(-this->m_numerator, this->m_denominator, true);
    }

    friend ::tools::fraction operator+(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator * rhs.m_denominator + rhs.m_numerator * lhs.m_denominator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator+(const ::tools::fraction& lhs, const T rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator + static_cast<::std::intmax_t>(rhs) * lhs.m_denominator, lhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator+(const T lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(static_cast<::std::intmax_t>(lhs) * rhs.m_denominator + rhs.m_numerator, rhs.m_denominator, true);
    }

    friend ::tools::fraction operator-(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator * rhs.m_denominator - rhs.m_numerator * lhs.m_denominator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator-(const ::tools::fraction& lhs, const T rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator - static_cast<::std::intmax_t>(rhs) * lhs.m_denominator, lhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator-(const T lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(static_cast<::std::intmax_t>(lhs) * rhs.m_denominator - rhs.m_numerator, rhs.m_denominator, true);
    }

    friend ::tools::fraction operator*(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator * rhs.m_numerator, lhs.m_denominator * rhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator*(const ::tools::fraction& lhs, const T rhs) noexcept {
      return ::tools::fraction(lhs.m_numerator * static_cast<::std::intmax_t>(rhs), lhs.m_denominator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator*(const T lhs, const ::tools::fraction& rhs) noexcept {
      return ::tools::fraction(static_cast<::std::intmax_t>(lhs) * rhs.m_numerator, rhs.m_denominator, true);
    }

    friend ::tools::fraction operator/(const ::tools::fraction& lhs, const ::tools::fraction& rhs) {
      if (rhs == 0) throw ::std::domain_error("Cannot divide by zero.");
      return ::tools::fraction(lhs.m_numerator * rhs.m_denominator, lhs.m_denominator * rhs.m_numerator, true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator/(const ::tools::fraction& lhs, const T rhs) {
      if (rhs == 0) throw ::std::domain_error("Cannot divide by zero.");
      return ::tools::fraction(lhs.m_numerator, lhs.m_denominator * static_cast<::std::intmax_t>(rhs), true);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend ::tools::fraction operator/(const T lhs, const ::tools::fraction& rhs) {
      if (rhs == 0) throw ::std::domain_error("Cannot divide by zero.");
      return ::tools::fraction(static_cast<::std::intmax_t>(lhs) * rhs.m_denominator, rhs.m_numerator, true);
    }

    ::tools::fraction& operator++() noexcept {
      return *this = *this + 1;
    }
    ::tools::fraction operator++(int) noexcept {
      const ::tools::fraction prev = *this;
      ++*this;
      return prev;
    }

    ::tools::fraction& operator--() noexcept {
      return *this = *this - 1;
    }
    ::tools::fraction operator--(int) noexcept {
      const ::tools::fraction prev = *this;
      --*this;
      return prev;
    }

    ::tools::fraction& operator+=(const ::tools::fraction& other) noexcept {
      return *this = *this + other;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    ::tools::fraction& operator+=(const T other) noexcept {
      return *this = *this + other;
    }

    ::tools::fraction& operator-=(const ::tools::fraction& other) noexcept {
      return *this = *this - other;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    ::tools::fraction& operator-=(const T other) noexcept {
      return *this = *this - other;
    }

    ::tools::fraction& operator*=(const ::tools::fraction& other) noexcept {
      return *this = *this * other;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    ::tools::fraction& operator*=(const T other) noexcept {
      return *this = *this * other;
    }

    ::tools::fraction& operator/=(const ::tools::fraction& other) {
      return *this = *this / other;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    ::tools::fraction& operator/=(const T other) {
      return *this = *this / other;
    }

    friend bool operator==(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return lhs.m_numerator == rhs.m_numerator && lhs.m_denominator == rhs.m_denominator;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator==(const ::tools::fraction& lhs, const T rhs) noexcept {
      return lhs.m_numerator == static_cast<::std::intmax_t>(rhs) && lhs.m_denominator == 1;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator==(const T lhs, const ::tools::fraction& rhs) noexcept {
      return static_cast<::std::intmax_t>(lhs) == rhs.m_numerator && 1 == rhs.m_denominator;
    }

    friend bool operator!=(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return !(lhs == rhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator!=(const ::tools::fraction& lhs, const T rhs) noexcept {
      return !(lhs == rhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator!=(const T lhs, const ::tools::fraction& rhs) noexcept {
      return !(lhs == rhs);
    }

    friend bool operator<(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return lhs.m_numerator * rhs.m_denominator < rhs.m_numerator * lhs.m_denominator;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator<(const ::tools::fraction& lhs, const T rhs) noexcept {
      return lhs.m_numerator < static_cast<::std::intmax_t>(rhs) * lhs.m_denominator;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator<(const T lhs, const ::tools::fraction& rhs) noexcept {
      return static_cast<::std::intmax_t>(lhs) * rhs.m_denominator < rhs.m_numerator;
    }

    friend bool operator>(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return rhs < lhs;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator>(const ::tools::fraction& lhs, const T rhs) noexcept {
      return rhs < lhs;
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator>(const T lhs, const ::tools::fraction& rhs) noexcept {
      return rhs < lhs;
    }

    friend bool operator<=(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return !(rhs < lhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator<=(const ::tools::fraction& lhs, const T rhs) noexcept {
      return !(rhs < lhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator<=(const T lhs, const ::tools::fraction& rhs) noexcept {
      return !(rhs < lhs);
    }

    friend bool operator>=(const ::tools::fraction& lhs, const ::tools::fraction& rhs) noexcept {
      return !(lhs < rhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator>=(const ::tools::fraction& lhs, const T rhs) noexcept {
      return !(lhs < rhs);
    }
    template <typename T, typename ::std::enable_if<::std::is_integral<T>::value, ::std::nullptr_t>::type = nullptr>
    friend bool operator>=(const T lhs, const ::tools::fraction& rhs) noexcept {
      return !(lhs < rhs);
    }
  };
}

namespace std {
  ::std::string to_string(const ::tools::fraction& f);
  ::tools::fraction abs(const ::tools::fraction& f);
  double sqrt(const ::tools::fraction& f);
  ::std::ostream& operator<<(::std::ostream& os, const ::tools::fraction& self);

  template <>
  struct hash<::tools::fraction> {
    typedef ::std::size_t result_type;
    typedef ::tools::fraction argument_type;
    ::std::size_t operator()(const ::tools::fraction& key) const {
      static const ::std::hash<::std::intmax_t> hash = ::std::hash<::std::intmax_t>();
      ::std::size_t result = 17;
      result = 31 * result + hash(key.numerator());
      result = 31 * result + hash(key.denominator());
      return result;
    }
  };
}

#endif

// lib/fraction.cpp

namespace std {
  ::std::string to_string(const ::tools::fraction& f) {
    return '(' + ::std::to_string(f.numerator()) + '/' + ::std::to_string(f.denominator()) + ')';
  }

  ::tools::fraction abs(const ::tools::fraction& f) {
    return f.numerator() < 0 ? -f : f;
  }

  double sqrt(const ::tools::fraction& f) {
    return ::std::sqrt(static_cast<double>(f));
  }

  ::std::ostream& operator<<(::std::ostream& os, const ::tools::fraction& self) {
    return os << ::std::to_string(self);
  }
}

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<tools::fraction> a;
  a.reserve(N);
  {
    std::vector<i64> a_i64;
    tools::read(a_i64, N);
    std::copy(a_i64.begin(), a_i64.end(), std::back_inserter(a));
  }

  const tools::fraction avg = std::accumulate(a.begin(), a.end(), tools::fraction(0, 1)) / N;

  std::cout << std::distance(a.begin(), std::min_element(a.begin(), a.end(), tools::less<tools::fraction, tools::fraction>([&avg](const tools::fraction& f) { return std::abs(f - avg); }))) << std::endl;
  return 0;
}

Measured memory_bytes: 256