function lonelyinteger(a: number[]): number {
for (let item of a) {
const items = a.filter(el => item === el)
if (items.length === 1) {
return item
}
}
}
const a:number[] = [1,2,3,4,3,2,1]
const result:number = lonelyinteger(a);
console.log(result)