  We study the superconformal index for the class of N=2 4d superconformal
field theories recently introduced by Gaiotto. These theories are defined by
compactifying the (2,0) 6d theory on a Riemann surface with punctures. We
interpret the index of the 4d theory associated to an n-punctured Riemann
surface as the n-point correlation function of a 2d topological QFT living on
the surface. Invariance of the index under generalized S-duality
transformations (the mapping class group of the Riemann surface) translates
into associativity of the operator algebra of the 2d TQFT. In the A_1 case, for
which the 4d SCFTs have a Lagrangian realization, the structure constants and
metric of the 2d TQFT can be calculated explicitly in terms of elliptic gamma
functions. Associativity then holds thanks to a remarkable symmetry of an
elliptic hypergeometric beta integral, proved very recently by van de Bult.
