TITLE: Lists of sets as objects of ZF axiomatics
QUESTION [5 upvotes]: I have a naive question about foundations of mathematics. A common opinion of most mathematicians is that the essential part of mathematics can be reduced to ZF(C) axioms. I do not quite understand one of basic steps of this reduction.
How to define rigorously an intuitive concept of "a finite sequence of arbitrary length consisting of arbitrary sets", in other words a concept of a sequence $X_1,X_2,\dots X_n$ where all $X_k$ are arbitrary sets. A difficulty here is that usually a finite sequence $y_1,\dots y_n$ (i.e. a list) is defined as a function from the segment $\{1,\dots n\}$
to some set $Y$ (i.e. as a sequence of elements of some set) but if we want to deal with arbitrary sets $X_k$ we do not have a priory such a set $Y$. 
More specifically, is it possible to formulate the following intuitive theorem as a single formula of ZF: "for any finite sequence of countable sets $X_1,\dots X_n$, their union is countable" or such a theorem can be realized in ZF only as a kind of theorem scheme? 

Edited after receiving first answers: Thanks everyone for explanations! As far as I understand now, everything depends on the definition of a function which is used. The problem described in my question appears if one uses the traditional definition of a function as a binary relation having functional property (as presented, e.g. in Wikipedia) because the domain and codomain must already  exist as sets before we obtain a function according to this definition. But if we use another definition of a function as an arbitrary set of ordered pairs  which satisfies functional property (see the comment of Max), we have no problems!

REPLY [2 votes]: A traditional way to formalize the notion of "function" in set theory goes like this:
a function is a set $f$ of ordered pairs such that, if $(x,y)\in f$ and $(x,z)\in f$ then $y=z$.
Given this definition, the expression ``$f(x)$'' can be explained to denote the $y$ such that $(x,y)\in f$.
Assuming that the function $F$ which $f$ formalizes is ``total'', then you can extract from $f$ the domain of $F$, namely as the class of $x$ such that $(x,y)\in f$ for some $y$.
However, there's no way to recover the range of $F$ from $f$. For example, the object
$\{(x,y):x\in\mathbb \omega\land y=0\}$
might formalize a function $F:\mathbb N\to\mathbb N$ or a function $F:\mathbb N\to \{0,1\}$ or...
This approach to formalizing functions ducks the problem you mention.  That is, a mapping of $F$ from integers $i< k$ to arbitrary sets $F(i)$ becomes the "set-sized" collection of pairs $(i,F(i))$ for $i<k$.
There is another way to think of functions as formalized, namely as proper classes, but I don't know that it's useful in formalizing ordinary mathematics.