#include <iostream>
#include <sstream>
#include <cstring>
#include <cassert>
using namespace std;

template <typename Type, int Count>
class Array
{
    enum { sz = Count };
    Type i[Count];

public:
    Array(){ memset(i, 0, Count*sizeof(*i)); }

    int& operator[](int x){
        assert(x >= 0 && x < Count && "Array::operator[] out of range");
        return i[x];
    }

    template <typename T, int U>
    friend ostream& operator<<(ostream& os, const Array<T,U>& ia);
    template <typename T, int U>
    friend istream& operator>>(istream& is, Array<T,U>& ia);
};

template <typename T, int U>
ostream& operator<<(ostream& os, const Array<T, U>& ia)
{
    for (int j = 0; j < ia.sz; j++){
        os << ia.i[j];
        if (j != ia.sz - 1)
            os << ", ";
    }
    return os << endl;
}

template <typename T, int U>
istream& operator>>(istream& is, Array<T, U>& ia)
{
    for (int j = 0; j < ia.sz; j++){
        is >> ia.i[j];
    }
    return is;
}

int main()
{
    stringstream input("47 34 56 92 103");
    Array<int, 5> I;
    input >> I;
    I[4] = -1;
    cout << I;
    return 0;
}