VDM-SL[VDM-SL], 64 bytes
f(a)==forall y in set inds a&card{x|x in set inds a&a(x)=a(y)}=2
###Explanation
VDM works predominantly like second order logic statements.
forall y in set inds a //Bind y to each of the indices of a
{x|x in set inds a&a(x)=a(y)} //build a set of the indices of a who have the same
//value as the value at y
card {...} = 2 //and check the cardinality of that set is 2
###Since you can't TIO VDM here's output from a debug session
[VDM-SL]: https://raw.githubusercontent.com/overturetool/documentation/master/documentation/VDM10LangMan/VDM10_lang_man.pdf